Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 379
Kavikant Singh Avatar asked Feb 21 '13 13:02

Kavikant Singh


1 Answers

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.

like image 131
Tanmay Verma Avatar answered Oct 20 '22 04:10

Tanmay Verma