I have blocked outgoing port 25 to prevent spam being sent from my servers.

However, I'm not very familiar with SMTP and I have heard that ports such as 465 and 587 can also be used to send mail, but over TLS.

Should I block those ports as well to prevent spam from being sent? Are there any other ports I should block as well?

Is it safe to ublock 587, SMTP submission port? mentions just 587, but I'm wondering about other ports as well.

  • What do you have going on with your servers that would be sending spam anyway? – EEAA Apr 17 '14 at 3:48
  • I'm running a hosting service, so some malicious users might come along and try to send spam, and I'm trying to prevent that. – 小太郎 Apr 17 '14 at 3:51

Normally ports 465 and 587 require user authentication prior to accepting emails - if this is the case, then you don't need to block these ports (from the purpose of being an open relay), as only users who are authenticated against your system can use them. That said, if you are not opening your system to incoming users, blocking them is a good idea (less access=less security risks).

Generally a secure firewall should be built "default deny", and I suggest thats what you do here if you can. You don't need 587 or 465 in order to receive email from other users.

Lastly, assuming your system is not an open relay, your system will most likely send spam if a users account (or a website using the mail server) is compromised. Tightening up the mail server won't help this behaviour - its a matter of educating users and locking down what can send email.

If you need a fallback, you can always attempt to run filters on outgoing mail or farm this task out to a third party provider - but this may well be overkill for your needs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.