How To Install And Configure Sendmail On Ubuntu

1. Install Sendmail

$ sudo apt-get install sendmail

2. Configure /etc/hosts file:

$ sudo nano /etc/hosts

Change the ‘ line to add your hostname to look like the same as: localhost.localdomain yourhost

example:       localhost Home.lan Home       Home.lan     Home

3. Run Sendmail’s config and answer ‘Y’ to everything:

$ sudo sendmailconfig

4. Restart apache

$ sudo service apache2 restart


If you can not send mail.

When sending emails from your server, make sure to check any spam folders for receipt. If email is for some reason not working, try the steps below:

4 sudo nano /etc/php/7.0/fpm/php.ini

Ctrl+w to search for and find ‘sendmail_path’. Uncomment this line and add the path below:

sendmail_path= /usr/sbin/sendmail -t -i

Restart php:

$ sudo service php7.0-fpm restart

2 thoughts on “How To Install And Configure Sendmail On Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.