Email.send randomly never returning

I have been successfully using the meteor email package (pointing to a MailGun smtp server) for my project but in the last few weeks have been having issues with the call to Email.send randomly never returning.

When this happens I don’t receive any errors on either the client or the server - the Email.send method just seems to hang.

I tend to find it works when the meteor server is restarted but after a few emails will just hang again.

I am wondering whether it could be anything to do with updating to Meteor as I notice someone else has an email issue (although they are at least getting an error).

Has anyone experienced this issue or have any ideas of what I can do to track down the problem?

I have experienced this issue, different servers (prod/dev) and different e-mail providers. On dev I even had my server process crash after sending e-mails and when it got restarted it picked up where it left off, repeating the last action, resulting in multiple duplicate entries in a collection … very odd indeed.

Maybe it’s related with this thread:

I am using email@1.2.0

Some people were having the issue with 1.2.0 too.

This is the error in my log (only on the dev server)

      throw er; // Unhandled 'error' event

Error: Unexpected Response: 451 4.4.2 Timeout - closing connection. y187sm37588509pfy.67 - gsmtp
    at SMTPConnection._processResponse (/Users/jhm/.meteor/packages/email/.1.2.0.imcrog++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:672:30) 
    at SMTPConnection._onData (/Users/jhm/.meteor/packages/email/.1.2.0.imcrog++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:493:10) at emitOne (events.js:77:13)
    at TLSSocket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at TLSSocket.Readable.push (_stream_readable.js:111:10)
    at TLSWrap.onread (net.js:540:20)
App 50349 stdout: => Exited with code: 1

The issue has appeared to have corrected itself for me.

I removed the email package (1.2.0) and then tried adding in 1.2.0 back in. After that the emails seem to reliably send. I also updated to 1.2.1 and they also send correctly.

I can only assume the email package somehow got corrupted and removing/adding back in corrected it.

I tested email package using several combinations of versions of this package and meteor. Meteor fails with email package versions 1.2.0 and 1.2.1. At first, operation Email.send fails to send any message (wireshark TCP protocol analyzer shows meteor trying to open an STMP connection which is never used to send email message). After solution proposed by matt90410 (reinstalling email package) operation Email.send succed in sending email message, but continues to fail and after a pair of minutes a timeout error or reported by jamgold shows killing Meteor/NodeJS server, which is very bad for production environments.

This situation is perhaps related with


Downgrading to meteor and email package 1.1.18 does not help, problem persists… email message is delivered but operation Email.send does not return. Running thread/fiber is killed after a time by a timeout, killing Meteor/NodeJS server, although less unstable (same problem, more difficult to reproduce).

(edit .meteor/release to specify METEOR@
meteor remove email
meteor --allow-incompatible-update add email@=1.1.18

All test was done on linux ubuntu 64 bits 15.04 and 14.04.5 LTS.

This was the error shown for Meteor and email package 1.2.0:

throw er; // Unhandled ‘error’ event

Error: Timeout
at SMTPConnection._onTimeout (/var/www/asambleaEnLinea_release/programs/server/npm/nod
at emitNone (events.js:67:13)
at TLSSocket.emit (events.js:166:7)
at TLSSocket.Socket._onTimeout (net.js:332:8)
at _runOnTimeout (timers.js:524:11)
at _makeTimerTimeout (timers.js:515:3)
at Timer.unrefTimeout (timers.js:584:5)

Remember to configure protocol smtps:// instead of smtp:// if using port TCP 465 or SSL connections…

Configuring smtps:// didn’t work at all on my servers.

Which port are you using?

We had what sounds like your problem. It manifested after upgrading email from 1.1.18 to 1.2.0. We were using smtp:// and port 587 in the MAIL_URL.

Switching the protocol to smtps resulted in a crash with the error SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol on sending (which makes sense as 587 isn’t necessarily TLS). Upgrading email to 1.2.1 seems to have fixed it.

I haven’t dug into exactly what the original issue was. We had the same Timeout error you mention above with email 1.2.0. I think I saw a mention that it may be something to do with the STARTTLS exchange. I’m afraid I can’t find that comment at the moment, but it sounds reasonable.

1 Like

@othermachines thank you for sharing. That is the error I saw. Will test if upgrade to 1.2.1 fixes it.

1 Like

Did you find a fix?
I deployed my app on Galaxy with email@1.2.1, using smtps in the MAIL_URL (mailgun port 587) and I’m getting the same ‘SSL23_GET_SERVER_HELLO’ error.

Any insight would be greatly appreciated…

Uninstalling and reinstalling email fixed the issue for me.

Try changing the protocol to smtp. STARTTLS starts as an smtp connection and upgrades to a secure connection if possible. See:

Thanks for your help! I reverted MAIL_URL back to smtp and Email.send works again. I didn’t know about STARTTLS and didn’t realize it would try upgrading to a secure connection by itself.

1 Like

Any solution on @jamgold problem? I’m getting the same issue as he experienced. :-(, anyone can recommend other package as alternative of email?


I’m having the same issue!!! It works when I start up a fresh instance, but eventually jus stops sending emails and doesn’t throw an error… this is a recent thing. I’m on 1.4

This also just started for me. I am running Meteor, and email was working but now just stops random ‘Greeting never received’. If starts again if I restart the app. I have not recently upgraded my meteor version, but I did upgrade my ubuntu packages recently. Is there a change there? I’m on ubuntu 14.04. I use nullmailer.