AWS SES与流星 [英] AWS SES with Meteor

查看:262
本文介绍了AWS SES与流星的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了一个流星封装接口与AWS SES名为 tarang:电子邮件SES 建造的@Akshat。

I'm trying to out a Meteor package to interface with AWS SES called tarang:email-ses built by @Akshat.

我对流星@ 1 *运行在AWS EC2实例。当我测试与下面的code运行,没有电子邮件被发送出去。

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.

我已经设置了AWS访问密钥ID和秘密访问键,并在这里使用它:

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'
  });
});

我也验证了我的电子邮件和领域。在这里,我要确保我从我的验证发件人SES的地址发送邮件:

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>';

然后在流星的方法,我创建一个新用户,并发送和招生电子邮件像这样(这个作品,如果我部署到meteor.com,没有当然的Accounts.emailTemplates.from):

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);
}

问题

时的code设置东西的电子邮件,SES包是否正确?

Questions

Is the code to set things up for the email-ses package correct?

我觉得这个包中抽象出来的​​亚马逊SES API来发送电子邮件(并允许本地流星邮件调用)。是否要求设置SMTP在AWS上?

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?

推荐答案

要在流星发送电子邮件至最简单的办法是使用设置SMTP服务器和用户名信息 process.env.MAIL_URL 变量。该帐户电子邮件包将自动使用它时,你将消息发送到访问SMTP服务器。

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.

要实现与AWS SES SMTP访问:

To enable SMTP access with AWS SES:

  1. 在登录到AWS管理控制台
  2. 选择你设置了SES相应的区域。
  3. 从应用服务的列表中选择SES
  4. 点击 SMTP设置在左边的菜单中的菜单项
  5. 点击创建我的SMTP凭证按钮
  6. 使用真实提供的默认用户名IAM。这是一个特殊的IAM用户将只能访问到SMTP服务器。访问SMTP服务器时,你不应该用你的主IAM用户名/密码。
  7. 请一定要注意SMTP服务器名称。以后你会需要它。
  8. 在帐户创建后下载的凭据。
  1. Log into the AWS Management Console
  2. Select the appropriate region where you set up SES.
  3. Select SES from the list of Application Services
  4. Click the SMTP Settings menu item in the left menu
  5. Click the Create My SMTP Credentials button
  6. Use the default IAM username that's provided. This is a special IAM user that will only have access to the SMTP server. You shouldn't use your main IAM username/password when accessing the SMTP server.
  7. Make sure to note the SMTP server name. You'll need it later.
  8. After the account is created download the credentials.

现在你有一个帐户设置,简单地复制并粘贴下面一行到你流星启动文件的顶部和替换从凭证文件中的值,你刚刚下载的用户名和密码,这是服务器名称提供的。

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';

请注意,无论是发送和接收的电子邮件地址必须在AWS SES管理控制台进行验证,如果你还没有收到生产准入呢。如果你不这样做流星会抛出一个错误在控制台和消息将不会被发送。

这篇关于AWS SES与流星的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆