Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
nodemailer EPIPE error #141
Using nodemailer v0.3.42.
The script below sometimes will finish and complete, but sometimes it will randomly fail at a random point with one of the following errors:
It does fail in the same way but with a different file/line number:
As far as I understand these EPIPE error occurs because the other end of a connection dropped and then we tried to write to that connection. No error is being passed back up via a throw or callback error argument so there seems to be no way to see what is causing the error.
The output of consistently shows the EPIPE errors start to occur when nodemailer is writing the multipart mime boundaries. but it wont always cause the error, only about 35% of the time it happens.
Is there a way error handling could be added for this?
Operating system: gentoo Linux (amd64 build, kernel 2.6.4)
On 27 Feb 2013, at 22:41, Andris Reinman firstname.lastname@example.org wrote:
To provide further insight Im pretty sure now that this has something to do with line length wrapping nodemailer is doing. I have my postfix server setup to write mails it receives to the filesystem so i can look at them.
I have reduced the code down to the following:
And this results in the following email file:
Only the text part of the email is being sent out and its getting cut off on a line which is being wrapped to cause only a dot (.) to be on the next line.
It is my understanding that a client of sendmail/SMTP tells it that it has finished writing to the socket by sending a line with only a dot (.) on it. In this case the wrapping happening is causing the dot on the end of that line to be wrapped onto a line by itself and therefore causing the socket to be closed prematurely.
The strace output in my original post backs this up by showing any writes after the text result in the EPIPE error.
This could also be causing the problem with further calls to the sendEmail function in nodemailer as the socket it was using has been closed.
If you change this one line of the source:
To add a newline before
Should nodemailer not handle escaping special character sequences it accidentally generates as a result of the wrapping?