Flavien Volken
Flavien Volken

Reputation: 21289

Meteor catching errors on email.send()

In the meteor email documentation it is written

Email.send({
      to: to,
      from: from,
      subject: subject,
      text: text
    });

Send an email. Throws an Error on failure to contact mail server or if mail server returns an error

Should I assume this is done synchronously on the server side and that I should use a try/catch statement in order to know if the mail did sent successfully ? If so then I would have to assume that no catch means no error ?

Upvotes: 2

Views: 963

Answers (1)

Tarang
Tarang

Reputation: 75945

Well you've answered this yourself:

  • It is sychronous
  • You would use try/catch in the case the mail server returns an error (if you've set MAIL_URL)
  • No catch means no error, again provided you've set MAIL_URL as the environmental variable.

Upvotes: 1

Related Questions