简体   繁体   English

Amazon SES-无法接收电子邮件

[英]Amazon SES - Can't get email to be delivered

I have an aws ubuntu server running a node.js application. 我有一个运行node.js应用程序的aws ubuntu服务器。 I am trying to build a simple forgot password feature which sends users email. 我正在尝试构建一个简单的忘记密码功能,该功能会向用户发送电子邮件。 The code runs but no email is delivered, so I assume I am still missing something. 该代码可以运行,但是没有发送电子邮件,因此我认为我仍然缺少一些东西。

1) Within SES I verified the email domain a2zcribbage.com. 1)在SES中,我验证了电子邮件域a2zcribbage.com。 I assume this means I can now send email from any alias under this domain, right? 我认为这意味着我现在可以从该域下的任何别名发送电子邮件了,对吗?

2) I npm installed the SES module onto my ec2 server. 2)我npm将SES模块安装到我的ec2服务器上。

3) My code looks as follows: 3)我的代码如下:

aws.config.update({accessKeyId: 'MYKEY', secretAccessKey: 'MYKEY', region: 'us-west-2'});
var ses = new aws.SES({apiVersion: '2010-12-01'}); // load AWS SES
var to = [post.email]; // send to list
var from = 'support@a2zCribbage.com'; // this must relate to a verified SES account
ses.sendEmail( { // this sends the email @todo - add HTML version
      Source: from, 
      Destination: { ToAddresses: to },
      Message: {
        Subject: { Data: 'a2zCribbage - Temporary Password' },
        Body: {
          Text: {
            Data: "Your username is: " + userName + ". Your temporary password is: " + tempPassword
          }
        }
      }
    }, function(err, data) { if (err) console.log(err); });

The code runs without error, but no email is delivered. 该代码运行没有错误,但是没有发送电子邮件。 How do I debug this further given there's no error? 如果没有错误,我该如何进一步调试呢?

My suggestion for your issue: 我对您的问题的建议:

  1. Make sure you have been removed from sandbox, to do that, you need contact aws to extend the limits, that's free service for any aws accounts. 确保已将您从沙箱中删除,为此,您需要联系aws来扩展限制,这是任何aws帐户的免费服务。

  2. register a real mailbox directly to SES, for example, support@a2zCribbage.com to test if the code works or not. 将真实邮箱直接注册到SES,例如, support@a2zCribbage.com以测试代码是否有效。

  3. From the code, seems you missed to load aws sdk. 从代码看来,您似乎错过了加载AWS开发工具包。

    var aws = require('aws-sdk'); var aws = require('aws-sdk');

  4. create a SNS task, subscript a SMS or mailbox, enable bounced or complain notification in SES, with it, you can confirm if the setting is proper or not. 创建SNS任务,为SMS或邮箱添加下标,在SES中启用退回或投诉通知,然后您可以确认该设置是否正确。

let me know if this can help you to fix your issue. 让我知道这是否可以帮助您解决问题。

I'll answer my own question here. 我会在这里回答我自己的问题。 Good feedback from everyone. 大家的好评。 The one thing I was missing is that by default, when you create an SES account, you are put into a "sandbox" mode, and not a full fledged email sending mode, so I was trying to send emails and it wasn't allowing it. 我所缺少的一件事是,默认情况下,当您创建SES帐户时,您会进入“沙盒”模式,而不是完全成熟的电子邮件发送模式,因此我试图发送电子邮件,但不允许它。 Once I requested I be taken out of sandbox mode everything worked just fine. 一旦我要求我退出沙盒模式,一切都将正常进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM