4

According to this guide:

It is important to secure your server and make sure that Postfix is not configured as an open relay.

It links to another guide which suggests using UFW as a firewall.

I'm running Apache on Ubuntu with a PHP application that needs to send email. I've installed postfix as my mail server.

I've configured UFW so far with:

sudo ufw allow ssh
sudo ufw allow www

To allow email out, would I tell UFW to allow smtp?:

sudo ufw allow smtp

Is there anything else I need to do to allow email to be sent out?

Highly Irregular
  • 215
  • 1
  • 3
  • 8

1 Answers1

4

Don't open your servers smtp port to the world. php should be sending mail using /usr/sbin/sendmail.

If you need to send out using a remote server, this Q&A may be of interest.

EEAA
  • 108,414
  • 18
  • 172
  • 242
84104
  • 12,698
  • 6
  • 43
  • 75
  • Ok, thanks. The sendmail command is provided by postfix. However how does sendmail/postfix send the email off the server if it doesn't use smtp? – Highly Irregular Apr 20 '16 at 02:00
  • 3
    Postfix does use smtp for this, but it does so as a client. This doesn't require exposing a server port. If you can apt-get or curl without issue, postfix should be able to send mail, at least as far as iptables/ufw is concerned. – 84104 Apr 20 '16 at 02:08