Sendmail Notes

Install Sendmail in Ubuntu
$ sudo apt-get update
$ sudo apt-get install sendmail
$ sudo sendmailconfig

Test sending an email:
echo "Subject: sendmail test" | sendmail -v
echo "This is the body of the email" | mail -s "This is the subject line"

To allow connections from ALL hosts/LAN IPs open file (login as the root):

# vi /etc/mail/

Look for line that read as follows:

DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA’)dnl

Comment or remove above line and insert new line that read as follows:


Regenerate the cf file
m4 >
sudo bash -c 'cd/etc/mail/ && m4 >'

Example for further configuration
After installing sendmail , you should configure sendmail. It`s little hard. But don`t worry after that we can spoof email to anyone.

Type following command on terminal

sudo gedit /etc/mail/

It will open file.

For example your last two lines are as follow



Put this code before that two lines.



Ok. now close that file

Now we will generate configure file from .mc file so type following command in terminal.

sudo bash -c 'cd/etc/mail/ && m4 >'

Using gmail smtp as the external smart host

Linux Email Servers Notes