Reputation: 5295
I am using django-ses
to send e-mail using AWS Simple E-mail Service. I have no problem sending using send_mail()
but from the same e-mail address set in settings, using mail_managers()
I am getting a MessageRejected
exception.
Here is a walk-through:
$ python manage.py ses_email_address -l
Fetching list of verified emails:
[email protected]
And via python shell:
>>> settings.DEFAULT_FROM_EMAIL
'[email protected]'
>>> settings.MANAGERS
(('omat', '[email protected]'),)
>>> send_mail('test', 'test', '[email protected]', ['[email protected]'])
1
>>> mail_managers('test', 'test')
BotoServerError: BotoServerError: 400 Bad Request
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
<Error>
<Type>Sender</Type>
<Code>MessageRejected</Code>
<Message>Email address is not verified.</Message>
</Error>
<RequestId>66269bb3-ca86-11e1-80db-5b89cf7a6356</RequestId>
</ErrorResponse>
Thanks for any help.
Upvotes: 0
Views: 1371
Reputation: 4306
I had some trouble getting error 500 emails raised in Amazon SES. This procedure may help others.
Things to check:
It works locally! (I used django.core.mail.backends.console.EmailBackend)
ADMINS
needs to be defined
Check that there are no filters which prevent mails being sent when DEBUG=False
If it doesn't work locally, run a debugger and step through AdminEmailHandler
. This might clear up why the email doesn't get sent.
If it all works locally, deploy to AWS.
Check that your application can send email (!), for example:
send_email()
Login to the SES console and check that the email has been sent (under 'Sending statistics')
Trigger a 500 error - sending statistics should also increase, indicating that SES sent an email.
Is the email received?
I had to ensure that DEFAULT_FROM_EMAIL
and SERVER_EMAIL
were set to email addresses listed as verified in SES
Upvotes: 0
Reputation: 25164
This isn't caused by django-ses
. Both mail_admins
and mail_managers
use the SERVER_EMAIL
setting as the From address not DEFAULT_FROM_EMAIL
: https://docs.djangoproject.com/en/1.4/topics/email/#mail-managers
Upvotes: 2