Search code examples
meteormailgun

Meteor: Can't send emails: SenderError: Mail from command failed - 501 Syntax error


I have asked this question on official meteor forum, but it didn't get any attention. I have deployed my meteor app via meteor deploy to the standard meteor hosting(appXX.meteor.com); I'd like to test sending emails from server, however when I try, I get this error:

SenderError: Mail from command failed - 501 Syntax
error

It's true, that I didn't setup a mailgun account, but my understanding is, that meteor takes care of that... when I debug my MAIL_URL env variable it's something like this:

smtp://postmaster%40appXXXXXX.mailgun.org:[email protected]:587

My email sending code, in coffeescript looks like this:

Email.send "[email protected]", "[email protected]", 
"Test subject", "Test email body"

To be more specific, the error message is not a mistake in my code(most likely, although I don't want to rule out that option, but I believe, my code really is ok), I think it's just a question of configuration of some account or whatever... I really don't know.

I'm probably missing something obvious. Can anybody help? Thanks


Solution

  • Email.send does not take a list of parameters, it takes a single options argument containing the mail sending operation configuration :

    Email.send
      from: "[email protected]"
      to: "[email protected]"
      subject: "Test subject"
      text: "Test email body"