aheckmann / node-ses

An Amazon SES api for nodejs with proper error handling.
http://aheckmann.github.com/node-ses
MIT License
200 stars 37 forks source link

Default permissions on AWS vs Region #27

Closed devlinsmith closed 8 years ago

devlinsmith commented 8 years ago

Hi,

I've noticed that when creating SMTP credentials in SES I get a default smtp user which I use for a key and secret. By default this user gets the policy to send emails, but ONLY RAW: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ses:SendRawEmail", "Resource": "" } ] } It doesn't contain the required: { "Effect": "Allow", "Action": "ses:SendEmail", "Resource": "" } in the "Statement" array for using this method in node-ses.

Then on the side - I also get and error: "{"Type":"Sender","Code":"MessageRejected","Message":"Email address is not verified."}", but it is, and so is the domain, and my account is not in sandbox. I eventually figured out that this error is actually because I didn't specify the domain (defaults to us-west-1 -as stated-, but I need eu-west-1). After this i figured out the above. Not sure if this is straight amazon message or node-ses, but might be worth adding this to your ReadMe.MD as a possible reason to get this error, as I did run in circles for about an hour or 2...

markstos commented 8 years ago

The unhelpful error message is being passed through from AWS. If they won't update their code to give a better error message, they could update their docs about this error to explain that the error can be thrown for other cases besides un-verified email. Have you been in touch with AWS about improving this upstream?

Is there a particular change you'd recommend to the docs here?

devlinsmith commented 8 years ago

I haven't taken this upstream.

Possibly add something about region should be specific (my silly mistake) and permission/policy (@ https://console.aws.amazon.com/iam/home?#users/ses-smtp-user.[insertrestofusername]) to the paragraph under client.sendEmail(options, function (err, data, res)) and client.sendEmailRaw.... (Important things to know).

Hopefully will save the next person from a bit of run around.

Otherwise really appreciate this work :+1:

markstos commented 8 years ago

You are welcome to submit a doc-patch PR if you'd like. I think you have clearer idea of what should possibly be changed than I do. I'm closing this issue as I'm not quite clear what the requested change is.