Linux – What’s the easiest way to let the Ubuntu Server send email behind a proxy

emaillinuxPROXY

I have an Ubuntu server and I have various needs to send email from it (automysqlbackup, other scripts, mantis bug tracker) but it has access to internet only using a proxy.
Postfix or anything else, as long as I'm able to send mail, it's perfect.

I could use Squid or Astaro Security Gateway, since we have two proxies on this network…

The easiest the best 🙂

Thanks a lot!

Best Answer

By default, when trying to send an email, Ubuntu will look up the MX record for the address domain, and try and send directly to that.

You have two options:

  • Set up an MTA on your Ubuntu server, such as Postfix or Exim, and configure that to relay to an internal SMTP server that can send outside the firewall (probably what you are thinking of when you say proxy)
  • or change the firewall configuration to allow outbound traffic on port 25 from your Ubuntu server - that is the easiest solution, especially if you have to ask someone else to do the firewall change :-)