Sendmail very slow - /etc/hosts configuration

Got the answer at superuser.com https://superuser.com/a/626219/242163:


Sendmail requires that the result of "hostname" be a fully qualified domain name to start cleanly.

Set the hostname to something like piotr-probook.localdomain and update /etc/hosts.

/etc/hosts

127.0.0.1   piotr-probook.localdomain piotr-probook localdev localhost

The above answer didn't work for me. So I am posting here what I have done to make it work.

Installed send mail through terminal

apt-get install sendmail

then opened the hosts file

# edited from: sudo gedit etc/hosts
sudo gedit /etc/hosts

replaced the the line

127.0.0.1 localhost

with

127.0.0.1 localhost localhost.localdomain mydomainname

To get the domain name please type

hostname

in terminal and run.

restart apache

sudo service apache2 restart

Tags:

Sendmail