Since a few months, it is increasingly common to add anti-spam blacklisting whole ranges of IP addresses of Amazon, with the consequent damage that can lead whom has their mail servers in those ip address ranges.
Now imagine the following scenario:
You have an application in an instance of Amazon that needs to send messages and uses a mail server on an instance of Amazon. If it happens that the ip of the mail server enters in a blacklist, your application will not be able to send messages.
Given this problem, you just have tow alternatives:
- be patient and wait for Amazon gets their range out from anti spam lists, which can take several days,
- or be cautious and use smtp authentication in your applications with external servers to Amazon.
If you chose the second option, I will explain how to perform it.
First of all, you must have at our disposal an external SMTP server to Amazon and it must be reliable in terms of blocking is concerned. Or you can hire a cheap hosting which offers only mail service , or a vps or dedicated server with a control panel, or if you prefer to conekia can configure a mail server for this purpose.
In order to send email from your application on Amazon to an external mail server, you can use libraries for smtp authentication. You have these libraries in php, python, etc.. The following python code performs this task:
mailserv= smtplib.SMTP(‘<<server host name>>’)
mailserv.login(‘<<username>>’, ‘<<password>>’)
mailserv.helo(‘<<originating server host name/ip>>’)
mailserv.sendmail(<<from email>>, <<to email>>, <<email msg>>
You will need the following data of the mail server:
- ip or hostname of mail server.
- user name.
- password.
With this you will ensure that messages sent by your application will not be blocked by the destination mail servers.