Reputation: 175
I've tried to use smtpd
but couldn't get it to work properly (Here's the link to the issue). I only need the server to receive emails and store in database. I've found few like MailGun, and although it looks great it is not free. Any suggestions?
Upvotes: 2
Views: 2047
Reputation: 3658
There are so many options, it's an opinion question, and also related to the specific use case. So here are the main options you have.
It's mostly your decision and not "with django". The question is really choosing a mail server for a web application.
From the django point of view it's either local server(faster), or external API. As a developer, sending SMTP is probably easier than external API because django already includes the backend handling. But good email service providers usually have a good clients libraries, and it's not that complex to use their API as well.
Your own email server: Install and maintain your own mail server. Pros: cheaper, a cheap VPS will do, no limits on accounts (useful for testings) and mails. Cons: installing a mail server + auth backend etc is not easy if you didn't installed one before, and your emails can be easily marked as spam. If you select this option, Postfix is a safe choice.
External service: with API. Pros: easier to implement, and less chances to be marked as spammer. Cons: more expensive, possible specifc coding against the specific API
Your mail server + external API: the local server connection is much faster, so django sends the email quickly, and then the server handles the slower sending to an external service
Summary: If you just start something, and need a simple email facility, pick an external service that uses SMTP. You will have something up and running, using the very easy django SMTP utilities, without specific coding to the vendor API. Once you need to scale, do the research and pick a more advanced solution.
Note: usually sending email requires some async queue, that allows django to pass the email sending task and continue with the request, without waiting to the smtp connection. SMTP connections can be slow.
Upvotes: 6