TAGS :Viewed: 9 - Published at: a few seconds ago

[ Django 1.7 separate error log email and internal code email ]

I want to have an email that sends reply using python no-reply@example.com and errors errors@example.com in the docs I've not found a way to separate between the two or specify which email to send with when using EmailMessage class, looking for a way to separate between the two since backlog of Internal Server Error when the site goes up makes email sent take long to be received.

Answer 1


According to Django docs: https://docs.djangoproject.com/en/1.8/topics/email/#send-mail

You can specify the email address in send_mail() function, so for exmaple when sending an email from no-reply@example.com you'll use:

send_mail(
    subject='My subject',
    message='Hello, world!',
    from_email='no-reply@example.com',
    recipient_list=list(User.objects.all().email),
    auth_user='no-reply@example.com',
    auth_password='yourpassword'
)