Using Django to send AWS emails with reverse DNS configuration to point to another server

I am trying to configure Django on an AWS instance to send email through my main website server (not AWS), instead of using external mail services like Mandrill, Amazon SES ... etc.

First, I set my DNS records for the main server to point the subdomain to the aws elastic IP address, for example:

mail1.website.com → 1.1.1.1

I requested a reverse DNS record, indicating that my AWS instance is elastic for the subdomain, he installed it, for example:

1.1.1.1 → mail1.website.com

Now that the reverse dns record is set to mail1.website.com , it should be used by django to send emails without being marked as spam.

https://docs.djangoproject.com/es/1.9/topics/email/#smtp-backend

Is it possible to use the following:

 EMAIL_HOST = 'mail1.website.com' DEFAULT_FROM_EMAIL = 'test.website.com' 

If I need to specify an email address / password / email port, you can configure it to log in using a specific email, for example aws_no_reply@website.com , but then send it via email with test@website.com or I need to configure the settings smtp root email address

No_reply email:

 EMAIL_HOST = 'mail1.website.com' EMAIL_HOST_USER = ' aws_no_reply@website.com ' EMAIL_HOST_PASSWORD = 'mypasshere' EMAIL_PORT = 465 DEFAULT_FROM_EMAIL = 'test.website.com' 

or root:

 EMAIL_HOST = 'mail1.website.com' EMAIL_HOST_USER = 'root' EMAIL_HOST_PASSWORD = 'mypasshere' EMAIL_PORT = 465 DEFAULT_FROM_EMAIL = ' test@website.com ' 
+6
source share
1 answer

I'm not sure I understand why you are trying to do this, but if your current email server is working correctly and you want to use it to relay emails from your AWS instance, I would simply establish a VPN connection between AWS and your current network and let your AWS instance send email in this way. You do not use your mail server as an external relay, so it cannot be changed.

But really, the right answer is to use SES to send emails. As long as you are not doing anything offensive, you should not have a delivery problem.

Edit: the specific exceptions you mention (SPF_SOFTFAIL, RDNS_DYNAMIC and HELO_DYNAMIC_IPADDR) may not disappear even if you set up reverse DNS for your public AWS IP address - you are still extracting from the pool of known "dynamic" IP addresses - AWS publishes a list of IP addresses here - and I doubt that people bothered to check if a small number of them are configured correctly.

Setting up SPF to allow AWS to send on your behalf is pretty easy .

+1
source

All Articles