Setup the PHP mail() function on a Ubuntu server

Stefan Ledin
1 min readJan 3, 2019

--

I’ve got a DigitalOcean server running Ubuntu 18 with Apache and PHP 7.2. I wanted to be able to send emails from it using the PHP mail() function and WordPress plugins like GravityForms and such.

After a lot of googling, I stumbled upon the excellent and very easy guide below. Only three steps where required to make it work:

  1. sudo apt-get install sendmail
  2. sudo sendmailconfig (answer Yes to everything)
  3. sudo service apache2 restart

--

--

Stefan Ledin

Web developer who makes fast WordPress sites with clean code and awesome backends. Also, JavaScript is nice!