2016-09-12 91 views
2

我创建了亚马逊线索帐户测试SES SMTP服务,但我得到了以下错误亚马逊SES - SMTP错误状态码403:SignatureDoesNotMatch

{ [SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. 


The Canonical String for this request should have been 
'POST 
/
host:email.us-west-2.amazonaws.com 
x-amz-content-sha256:72ac6f1d5dc1a4218fc4076dea3277a8a676b15e2c5143229cb3503465817440 
x-amz-date:20160912T084424Z 

host;x-amz-content-sha256;x-amz-date 
72ac6f1d5dc1a4218fc4076dea3277a8a676b15e2c5143229cb3503465817440' 

The String-to-Sign should have been 
AWS4-HMAC-SHA256 
20160912T084424Z 
20160912/us-west-2/ses/aws4_request 
a1b9fe2e23bbd4456f9b2a8f4115bd84571b8ccbbf9612d2e6b9d330ca6975a7' 
] 
    message: 'The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.\n\nThe Canonical String for this request should have been\n\'POST\n/\n\nhost:email.us-west-2.amazonaws.com\nx 
-amz-content-sha256:72ac6f1d5dc1a4218fc4076dea3277a8a676b15e2c5143229cb3503465817440\nx-amz-date:20160912T084424Z\n\nhost;x-amz-content-sha256;x-amz-d 
ate\n72ac6f1d5dc1a4218fc4076dea3277a8a676b15e2c5143229cb3503465817440\'\n\nThe String-to-Sign should have been\n\'AWS4-HMAC-SHA256\n20160912T084424Z\n 
20160912/us-west-2/ses/aws4_request\na1b9fe2e23bbd4456f9b2a8f4115bd84571b8ccbbf9612d2e6b9d330ca6975a7\'\n', 
    code: 'SignatureDoesNotMatch', 
    time: Mon Sep 12 2016 14:14:27 GMT+0530 (India Standard Time), 
    requestId: '1cc26156-78c5-11e6-8397-a55641b47b84', 
    statusCode: 403, 
    retryable: false, 
    retryDelay: 55.79463441390544 } 

这里是的NodeJS脚本,我使用

var aws = require('aws-sdk'); 
var ses = new aws.SES({ 
    'accessKeyId': 'KEY', 
    'secretAccessKey': 'SECRET', 
    'region': 'REGION' 
}); 
var eparam = { 
    Destination: { 
     ToAddresses: ['[email protected]'] 
    }, 
    Message: { 
     Body: { 
      Html: { 
       Data: '<p>Hello, this is a test email!</p>' 
      }, 
      Text: { 
       Data: 'Hello, this is a test email!' 
      } 
     }, 
     Subject: { 
      Data: 'SES email test' 
     } 
    }, 
    Source: '[email protected]', 
    ReplyToAddresses: ['[email protected]'], 
    ReturnPath: '[email protected]' 
}; 

ses.sendEmail(eparam, function (err, data) { 
    if (err) console.log(err); 
    else console.log(data); 
}); 

请注意:

emailids [email protected][email protected] 都被验证。我SES区域是美国西2

+0

您需要立即使这些IAM凭证立即失效(如果它们是真实的),并且不要在将来在线发布您的密钥。这样做会使您承担潜在的严重责任,并可能使您的帐户受到损害。希望这是一个例子,但它看起来很真实。 –

回答

0

我一直有同样的问题,我结束了使用SMTP设置,与此类似tutorial,并降级为从2.6 - > 0.7.1得到我的邮件发送。在某些地方存在某种配置问题,这种问题在两天的特定谷歌搜索后没有被很好地记录下来。