Skip to content

Instantly share code, notes, and snippets.

@tihoho
Created January 27, 2019 20:39
Show Gist options
  • Save tihoho/a795ea8813530c6088b07d6123f62216 to your computer and use it in GitHub Desktop.
Save tihoho/a795ea8813530c6088b07d6123f62216 to your computer and use it in GitHub Desktop.
Stopping spam is a constant fight and due to this, your account has restrictions specifically on port 25. However, you are be able to use mail services using ports 587, 993, 995 and 465. You will need to open these ports in your firewall. Here is our guide to common iptables commands:
https://www.digitalocean.com/community/tutorials/iptables-essentials-common-firewall-rules-and-commands#service-mail
We realize this is inconvenient, but many customers in your position move their mailing activities to a third party service such as SendGrid or similar which processes such mail separately from their droplet. I'm sorry for the frustration but we're not able to lift this port restriction at this time.
In terms of a workaround, here are a few alternatives:
1. Utilize port 587 for SMTP relay via another mail provider, for example G Suite/Gmail, Mailgun, etc. We have a guide on doing so using Postfix here:
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-mail-relay-with-postfix-and-mailgun-on-ubuntu-16-04
2. Configure your app or service to send mail directly using either a SMTP client connection (typically using port 587), or API call via another mail provider such as Sendgrid, Mailgun, Mandrill, etc.
Please note that with this restriction in place on port 25, mail servers hosted here will be unable to directly relay email to other mail servers, as communication between mail servers typically takes place on port 25.
We think the API is the best solution, as it is honestly more scalable and what we would use if we wanted to "future proof" the project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment