I'm trying to send an email from my alex.divito@mountainviewwebtech.ca
email address, but I am receiving the following error:
{
"error": {
"statusCode": 400,
"name": "InvalidParameterValue",
"message": "The From ARN <alex.divito@mountainviewwebtech.ca> is not a valid SES identity.",
"code": "InvalidParameterValue"
}
}
Both the from, and to email address show a verified
status in the SES console and I have attached the following Identity Policy
to the alex.divito@mountainviewwebtech.ca
email address:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "stmt1496992141256",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::xxxxxxxxxxxxxxx:root"
},
"Action": [
"ses:SendEmail",
"ses:SendRawEmail"
],
"Resource": "arn:aws:ses:us-west-2:xxxxxxxxxxxxxxx:identity/alex.divito@mountainviewwebtech.ca"
}
]
}
Yet when I run the following NodeJS code, I receive the above error:
Mail.send = function(email, cb) {
var ses_mail = "From: 'AWS Tutorial Series' <" + email + ">\n";
ses_mail = ses_mail + "To: " + "alexdiv87@hotmail.com" + "\n";
ses_mail = ses_mail + "Subject: AWS SES Attachment Example\n";
ses_mail = ses_mail + "MIME-Version: 1.0\n";
ses_mail = ses_mail + "Content-Type: multipart/mixed; boundary=\"NextPart\"\n\n";
ses_mail = ses_mail + "--NextPart\n";
ses_mail = ses_mail + "Content-Type: text/html; charset=us-ascii\n\n";
ses_mail = ses_mail + "This is the body of the email.\n\n";
ses_mail = ses_mail + "--NextPart\n";
ses_mail = ses_mail + "Content-Type: text/plain;\n";
ses_mail = ses_mail + "Content-Disposition: attachment; filename=\"attachment.txt\"\n\n";
ses_mail = ses_mail + "AWS Tutorial Series - Really cool file attachment!" + "\n\n";
ses_mail = ses_mail + "--NextPart--";
var params = {
RawMessage: { /* required */
Data: new Buffer(ses_mail) /* required */
},
Destinations: [
email
],
FromArn: 'alex.divito@mountainviewwebtech.ca',
ReturnPathArn: 'alex.divito@mountainviewwebtech.ca',
Source: 'alex.divito@mountainviewwebtech.ca',
SourceArn: 'alex.divito@mountainviewwebtech.ca'
};
ses.sendRawEmail(params, function(err, data) {
if (err) return cb(err);
else return cb(null, data);
});
};
Aws docs: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SES.html
via SuperVeetz
No comments:
Post a Comment