0
votes

I'm able to send the emails to my recipients using Amazon SES service with Node.js but I'm unable to see if the emails are bouncing back if I enter a wrong recipients emailIDs.

Please let me know if I need to add something to get the bounce back response.

I am sending the email using the following code:

app.get('/emailData', function (req, res) {
  var emailfrom = "[email protected]";
  var emailto = "[email protected]";

  var ses_mail = "From: 'AWS' <" + emailfrom + ">\n";
  ses_mail = ses_mail + "To: " + emailto + "\n";


  var params = {
    RawMessage: { Data: new Buffer(ses_mail) },
    Destinations: [ emailto ],
  };

  ses.sendRawEmail(params, function(err, data) {
    if(err) {
      res.send(err);
    } 
    else {
      res.send(data);
    }
  )};        
});
1
AFAIK you can't detect that when sending the email; you would have to use an imap library and regularly check for incoming emails about the outgoing one bouncing back. - Chris G

1 Answers

0
votes

You need to use Amazon SES Notifications in order to monitor bounce or complaint events. You cannot get immediate feedback when sending (ses.sendRawEmail doesn't error).

Amazon SES can notify you of bounce or complaint events in three ways: by sending a notification email, by notifying an Amazon SNS topic, or by publishing sending events.

You can have Amazon SES notify a SNS topic in case of a bounce event and have a Lambda function subscribe to this topic. This way you can implement you own logic in case of a bounce.

See Monitoring Using Amazon SES Notifications.