How I configured sendmail for PHP on Ubuntu Server 14.04

Go to terminal and run the following command to install sendmail
aptitude install sendmail

I put “mysite.localhost” (mysite is my server name) to /etc/hosts so it looks like this: localhost.localdomain localhost mysite.localhost mysite

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Create one sample text file for test email (body.txt)

Subject: test mail to Some Address!
From: Me <>
first line of my message for testing


To test how sendmail works I used the following command:
/usr/sbin/sendmail -t -f -v -i < body.txt

Reference Site :