0
votes

I'm integrating Amazon SES SDK in my iOS app. I have recently observed that, I'm unable to send mails from a verified email address. if I switch to US_WEST_2 region. The problem seem to be with iOS SDK, as I'm able to send mail from Amazon Console using same mail address.

Error Message: exception={SESMessageRejectedException { RequestId:70ed2e9e-dc16-11e3-89ca-956987a01a60, ErrorCode:MessageRejected, Message:Email address is not verified. }}, errorCode=MessageRejected}

Code: SESManager class:

    SESSendEmailRequest *ser = [[SESSendEmailRequest alloc] init] ;

    ser.source      = strSenderMailAddress;
    ser.destination = destination;
    ser.message     = message;

    SESSendEmailResponse *response = [[AmazonClientManager ses] sendEmail:ser];

AmazonClientManager:

+(AmazonSESClient *)ses
{
    [AmazonClientManager validateCredentials];
    return ses;
}

+(void)validateCredentials
{
    if ([AmazonClientManager hasCredentials]) {

            [AmazonClientManager clearCredentials];

            ses = [[AmazonSESClient alloc] initWithAccessKey:[Lockbox stringForKey:kLockboxAmazonAccessKey] withSecretKey:[Lockbox stringForKey:kLockboxAmazonSecretKey]];

 ses.endpoint = [AmazonEndpoints sesEndpoint:@"https://email.us-west-2.amazonaws.com"];

    }
}
3
Can you share the code snippet for instantiating an SES client and sending an email so that I can repro the issue?Yosuke Matsuda
Hi Yosuke, Please check code snippet. As per guideline, I have verified a new email address for US_WEST_2 region, but I'm unable to send mail using my app with that email address. But, It's working fine if, I try send mail from Amazon console using the same email address.niks

3 Answers

0
votes

It sounds like what you are seeing is by design.

The regions are independent systems, like much of AWS.

You must verify each sender’s email address separately for each region you want to use.

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/regions.html

0
votes

sesEndpoint: takes an AmazonRegion, which is defined as follows:

typedef enum
{
    US_EAST_1      = 0,
    US_WEST_1      = 1,
    EU_WEST_1      = 2,
    AP_SOUTHEAST_1 = 3,
    AP_NORTHEAST_1 = 4,
    US_WEST_2      = 5,
    SA_EAST_1      = 6,
    AP_SOUTHEAST_2 = 7
} AmazonRegion;

You need to change this line:

ses.endpoint = [AmazonEndpoints sesEndpoint:@"https://email.us-west-2.amazonaws.com"];

to this:

ses.endpoint = [AmazonEndpoints sesEndpoint:US_WEST_2];

When you pass an invalid region, it will default to the US East 1 region. That's why you are getting the exception.

Hope this helps,

0
votes

I would suggest instead of verifying emails you look on the following issue where you can make it more Production based.

How can i send mail without verifying the recipients in amazon ses

This approach is more correct & more appropriate even though you do it for any region.