简体   繁体   中英

Amazon SES - Can't get email to be delivered

I have an aws ubuntu server running a node.js application. 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. 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.

3) My code looks as follows:

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.

  2. register a real mailbox directly to SES, for example, support@a2zCribbage.com to test if the code works or not.

  3. From the code, seems you missed to load 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.

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. Once I requested I be taken out of sandbox mode everything worked just fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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