Amazon SES Email address is not verified

32,520

Solution 1

Your code indicates that you are trying to send via us-west-2. Have you requested production access in that region, and is your From address verified? Production access for Amazon SES is region-independent and you need to request it separately for each region.

If you do not have production access, you should make sure that both From and To addresses are verified. The Amazon SES console will list your verified email addresses and verified domains for us-west-2. The Amazon SES blog has additional guidance on how you can get set up in us-west-2.

A quick way to tell if you do not have production access: log in to the Amazon SES console dashboard and it will display a blue banner with the following text at the top of the page with a button to request production access:

Your Amazon SES account has "sandbox" access in region US West (Oregon). With sandbox access you can only send email to the Amazon SES mailbox simulator and to email addresses or domains that you have verified. Learn more.

Can't find your existing account settings? Your account may be set up in a different AWS region. Try switching regions in the upper right corner of the console.

Solution 2

Are you by chance still running in 'sandbox' mode? If you are, you can only send emails to addresses that have been pre-verified.

From Amazon:

Email address is not verified—Your account is in the sandbox and one of the recipient email addresses has not been verified. This might apply to "Sender", "Return-Path", or "From" addresses.

If you have not requested production access to Amazon SES, you must verify every recipient email address except for the recipients provided by the Amazon SES mailbox simulator. You must also verify your own "From" address. For more information, see Verifying Email Addresses and Domains in Amazon SES and Testing Amazon SES Email Sending.

More information here: http://docs.aws.amazon.com/ses/latest/DeveloperGuide/ses-errors.html

Solution 3

After weeks of messing around, I finally sorted this out. So if you are out of the sandbox, have verified your domain and your FROM email address, beware of the default Region. As you already know (just a guess), being out of the sandbox is region-specific (as well as the verified email and domain).

My problem was that I was that in all of the permutations of how to send an email with AWS SDK Java, I was not able to specify an explicit region and my USA account was defaulting the region to USA West. My Region where I did all of the verification (and was out of the Sandbox) was Europe West (email-smtp.eu-west-1.amazonaws.com). Also don't forget to use the proper credentials for Amazon SES API which are the AWS access keys. In my case (below) those keys are in a file, in the classpath with two key-value pairs:

accessKey = AKI...
secretKey = AsVyp...

And here is the code:

import java.io.IOException;

import java.util.ArrayList;
import java.util.Properties;
import java.util.Arrays;


import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

import com.amazonaws.auth.PropertiesCredentials;
import com.amazonaws.services.simpleemail.AWSJavaMailTransport;
import com.amazonaws.services.simpleemail.AmazonSimpleEmailService;
import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient;
import com.amazonaws.services.simpleemail.model.ListVerifiedEmailAddressesResult;
import com.amazonaws.services.simpleemail.model.VerifyEmailAddressRequest;
//import com.amazonaws.services.ec2.model.Region;
import com.amazonaws.services.simpleemail.*;
import com.amazonaws.services.simpleemail.model.*;
import com.amazonaws.regions.*;

public class AmazonSESSample {

static final String FROM = "[email protected]";  
static final String TO = "[email protected]";                                                       // 
static final String BODY = "This email was sent through Amazon SES by using the AWS SDK for Java.";
static final String SUBJECT = "Amazon SES test (AWS SDK for Java)";


public static void main(String[] args) throws IOException {     

    // Construct an object to contain the recipient address.
    Destination destination = new Destination().withToAddresses(new String[]{TO});

    // Create the subject and body of the message.
    Content subject = new Content().withData(SUBJECT);
    Content textBody = new Content().withData(BODY); 
    Body body = new Body().withText(textBody);

    PropertiesCredentials credentials = new PropertiesCredentials(
            AmazonSESSample.class
                    .getResourceAsStream("AwsCredentials.properties"));

    Message message = new Message().withSubject(subject).withBody(body);
    SendEmailRequest request = new SendEmailRequest().withSource(FROM).withDestination(destination).withMessage(message);

    try
    {        

        AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(credentials);
        Region REGION = Region.getRegion(Regions.EU_WEST_1);
        client.setRegion(REGION);
        client.sendEmail(request);  
        System.out.println("Email sent!");
    }
    catch (Exception ex) 
    {
        System.out.println("The email was not sent.");
        System.out.println("Error message: " + ex.getMessage());
    }
}

}

Solution 4

Also double check to make sure your not running in production mode and/or make sure your sending TO address is verified in Sandbox Mode.

Limitations of AWS SES Sandbox Mode:

  • You can only send mail to the Amazon SES mailbox simulator and to verified email addresses and domains.
  • You can only send mail from verified email addresses and domains.
  • You can send a maximum of 200 messages per 24-hour period.
  • Amazon SES can accept a maximum of one message from your account per second.

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html

Share:
32,520
leedream
Author by

leedream

Updated on November 13, 2020

Comments

  • leedream
    leedream over 3 years

    I'm starting with the amazon servers and started studying about SES. I am using asp.net C # and made ​​my code based tutorials. I already checked the domain and also checked the emails in which I will run the test.

    So that when I run my code it generates the following error message: Transaction failed. The server response was: Message rejected: Email address is not verified.

    I do not know what it is because I followed all possible steps, single detail is not yet ordered the release of access to production.

    But I think it can not be, I'm still testing the service.

    My Code

    public void enviarSES02()
            {
                try
                {
                    const String FROM = "verified email address"; 
                    const String TO = "verified email address"; 
    
                    const String SUBJECT = "Amazon SES test (SMTP interface accessed using C#)";
                    const String BODY = "This email was sent through the Amazon SES SMTP interface by using C#.";
    
                    const String SMTP_USERNAME = "my username";  // Replace with your SMTP username. 
                    const String SMTP_PASSWORD = "my password";  // Replace with your SMTP password.
    
                    const String HOST = "email-smtp.us-west-2.amazonaws.com";
    
                    const int PORT = 25;//already tried with all recommended ports
    
                    SmtpClient client = new SmtpClient(HOST, PORT);
                    client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
    
                    client.EnableSsl = true;
    
                    try
                    {
                        Console.WriteLine("Attempting to send an email through the Amazon SES SMTP interface...");
                        client.Send(FROM, TO, SUBJECT, BODY);
                        Response.Write("ENVIADO");
                    }
                    catch (Exception ex)
                    {
                        Response.Write("<br>O e-mail não foi enviado.<br>");
                        Response.Write("Olhao erro: " + ex.Message);
                    }
    
                }
                catch (Exception ex)
                {
                    Response.Write("Error message: " + ex.Message);
                }
    
            }