Install sendmail on Ubuntu 14.04/16.04

#Entering the following command into the terminal –

1) Install sendmail

sudo apt-get install sendmail

2) Configure sendmail
Enter the following command into the terminal and type “Y” for each question it asks –

sudo sendmailconfig

3) Edit hosts file

sudo nano /etc/hosts

Add/Edit the following line to your hosts file and save it-

127.0.0.1 localhost localhost.localdomain YOUR_DOMAIN.com

4) Restart apache
Let’s restart apache –

sudo service apache2 restart

Hope it works’s on your Ubuntu 14.04/16.04.