I decided that part of the results created by the project will be provided to users by email. I have my site run by cherrypy (Python 3) on Ubuntu 16.04 (I used until recently 14.04 and everything worked on both systems) located at DigitalOcean.
What I wanted was to send emails from specific email address (using my domain name), ensure that emails won’t end up in the spam folder and redirect all emails send to any email address on my domain to specific email.
Easiest solution was postfix.
First attempt resulted in successful email sending, however, directly to spam folder. To solve this issue, there are some online free software to check what is wrong with the emails sent. Just to name some:
Actually, I liked the latter better. First has restrictions about number of free usages per day and despite of not so user-friendly interface it was easier for me to draw some conclusions from the latter. Most important was:
- HELO greeting
HELO was easiest as it is set in postfix configuration.
SPF need to be changed on the site of DNS (for me it was on DigitalOcean site).
For DKIM I used opendkim (and other perl libraries needed for opendkim proper functioning).
And that did the trick, I can send emails and receive emails as well.
Inside the app (cherrypy) I use smtplib for sending emails and email.mime for formatting emails and attachments (there are some differences in mime use between Python2 and Python3).
And it’s up and running :).