2016-09-12 116 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得到我的郵件發送。在某些地方存在某種配置問題,這種問題在兩天的特定谷歌搜索後沒有被很好地記錄下來。