How to check if email is valid before send through Amazon SES

Kavikant Singh picture Kavikant Singh · Feb 21, 2013 · Viewed 12.9k times · Source

I am fresh in implementing Amazon Web services. I am working on implementing an application for sending bulk emails from a queue. I have to check emails and remove non-verified emails from the queue before sending.

My question is: Is there any method available in Amazon to check whether emails are valid or not?

Answer

Tanmay Verma picture Tanmay Verma · Feb 11, 2016

You can use the "getIdentityVerificationAttributes" operation to check whether emails are valid or not. You can use this as shown below:

var params = {
    Identities: arr // It is a required field (array of strings).
};
ses.getIdentityVerificationAttributes(params, function(err, data) {
    if(err)
        console.log(err, err.stack); // an error occurred
    else
        console.log(data);           // successful response
});

And the Response will be:

{ ResponseMetadata: { RequestId: '7debf2356-ddf94-1dsfe5-bdfeb-efsdfb5b653' },
  VerificationAttributes: 
   { '[email protected]': { VerificationStatus: 'Pending' },
     '[email protected]': { VerificationStatus: 'Success' } } } 

If there is an email-id which is not sent previously for email verification request, then there is no key present in 'VerificationAttributes' object.