We have a Meteor application that we're getting ready to deploy and we're finally at the point of hooking it up to a gmail account to send emails. The email configuration is setup as
Meteor.startup(function () {
smtp = {
username: 'noreply@cloaklabs.com',
password: 'abcdabcdabcdabcd', // masked - a gmail application-specific 16 character password to use for two-factor auth
server: 'smtp.gmail.com',
port: 587 // also tried 465 to no avail
};
process.env.MAIL_URL = 'smtp://' + encodeURIComponent(smtp.username) + ':' + encodeURIComponent(smtp.password) + '@' + encodeURIComponent(smtp.server) + ':' + smtp.port;
});
When the application calls Email.send(...) directly the email is sent successfully.
However when we do:
Accounts.createUser({email: email, password: password, profile: profile},function(err){...})
We get the following traceback in the server log:
Exception while invoking method 'createUser' SenderError: Mail from command failed - 555 5.5.2 Syntax error. ba12sm12306756pac.23 - gsmtp
at Object.Future.wait (/Users/Michel/.meteor/packages/meteor-tool/.1.0.40.1wbeh3b++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:326:15)
at smtpSend (packages/email/email.js:91:1)
at Object.Email.send (packages/email/email.js:168:1)
at Object.Accounts.sendVerificationEmail (packages/accounts-password/password_server.js:602:1)
at Meteor.methods.createUser (packages/accounts-password/password_server.js:723:1)
at tryLoginMethod (packages/accounts-base/accounts_server.js:186:1)
at Object.Accounts._loginMethod (packages/accounts-base/accounts_server.js:302:1)
at [object Object].Meteor.methods.createUser (packages/accounts-password/password_server.js:699:1)
... traceback truncated
This feels like a bug. About as close as I get to a relevant question on SO is 555 5.5.2 Syntax error. gmail's smtp There the recommendation is to use
"name <emailAddress>"
instead of just "emailAddress" for the recipient's address but there's no way to push this syntax through Accounts.createUser() and in any event Email.send() works without that complication.