ios - Amazon SES: sending email error -
i using awsses sending email.
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { awsstaticcredentialsprovider *credentialsprovider = [[awsstaticcredentialsprovider alloc] initwithaccesskey:my_key secretkey:my_secret]; awsserviceconfiguration *configuration = [[awsserviceconfiguration alloc] initwithregion:awsregionuseast1 credentialsprovider:credentialsprovider]; [awslogger defaultlogger].loglevel = awslogleveldebug; [awsses registerseswithconfiguration:configuration forkey:@"useast1ses"]; }
send email function
- (void) email { awssescontent *messagebody = [[awssescontent alloc] init]; messagebody.data = [nsstring stringwithformat: @"test email"]; awssescontent *subject = [[awssescontent alloc] init]; subject.data = [nsstring stringwithformat: @"feedback user"]; awssesbody *body = [[awssesbody alloc] init]; body.text = messagebody; awssesmessage *message = [[awssesmessage alloc] init]; message.subject = subject; message.body = body; awssesdestination *destination = [[awssesdestination alloc] init]; destination.toaddresses = @[email_verified]; awssessendemailrequest *ser = [[awssessendemailrequest alloc] init]; ser.source = email_verified; ser.destination = destination; ser.message = message; awsses *ses = [awsses sesforkey:@"useast1ses"]; [ses sendemail:ser completionhandler:^(awssessendemailresponse * _nullable response, nserror * _nullable error) { nslog(@" email"); }]; }
i getting following error
error domain=com.amazonaws.awsserviceerrordomain code=3 "(null)" userinfo={type=sender, message=the request signature calculated not match signature provided. check aws secret access key , signing method. consult service documentation details. canonical string request should have been 'post / content-type:application/x-www-form-urlencoded; charset=utf-8 host:email.us-east-1.amazonaws.com user-agent:aws-sdk-ios/2.4.0 iphone-os/9.2 en_us x-amz-date:20160425t063758z content-type;host;user-agent;x-amz-date 16cb4baebd2874efba56f725430b36a57d5efa17b3af5d9fc38856fa0f17d5e5' string-to-sign should have been 'aws4-hmac-sha256 20160425t063758z 20160425/us-east-1/email/aws4_request 9d3d181a3ab229898db9d7578b7b485ad61c19e07fe14c38d35ee4ed38ef1a94' , code=signaturedoesnotmatch, __text=( "\n ", "\n ", "\n ", "\n " )}
i have been struggling error more day. appreciated. couldn't find proper documentation this.
note: able configure awsses in server same email , secret key
Comments
Post a Comment