I'm trying to out a Meteor package to interface with AWS SES called tarang:email-ses
built by @Akshat.
I'm on Meteor @1.* running on a AWS EC2 instance. When I a test run with the code below, no email was sent out.
I've set up the AWS access key ID and secret access key and use it here:
Meteor.startup(function () {
Email.configSES({
AWSAccessKeyID: 'access-key',
AWSSecretKey: 'secret-key'
});
});
I've also verified my emails and domain. Here I make sure I'm sending from my verified sender SES address:
Accounts.emailTemplates.from = 'Domain Name <support@domain-name.com>';
Then in a Meteor method, I create a new user and send and enrollment email like so (this works if I deploy to meteor.com, without the Accounts.emailTemplates.from of course):
if (Meteor.user() && adminUser(this.userId)) {
var accountId = Accounts.createUser({
'username': doc.name,
'email': doc.email
});
Accounts.sendEnrollmentEmail(accountId);
}
Is the code to set things up for the email-ses package correct?
I thought this package abstracted out the Amazon SES API to Send Email (and allowed for native Meteor email calls). Is there a requirement to set up SMTP on AWS?
To send email in Meteor the easiest thing to do is to set the SMTP server and username information using process.env.MAIL_URL
variable. The Accounts
and Email
packages will automatically use it to access the SMTP server whenever you send a message.
To enable SMTP access with AWS SES:
Now that you have an account set up, simply copy and paste the following line to the top of your Meteor startup file and replace the username and password from the values in the credential file that you just downloaded and the server name that was provided.
process.env.MAIL_URL = 'smtp://username:password@smtp-server-name:465';
Please note that both the sending and receiving email addresses must be verified in the AWS SES management console if you haven't received production access yet. If you don't do this Meteor will throw an error in the console and the message will not be sent.