Question

Sendmail hangs when trying to send mail.

Whenever I try to use sendmail to send email, the server hangs indefinitely and I am forced to restart the ssh session to be able to issue any commands. Even simply typing “sendmail” causes the server to hang.

I have taken the following steps to install send mail:

  1. sudo apt-get install sendmail

  2. I configured the hosts file at “nano /etc/hosts” by adding this as suggested by a another user in the help community: “127.0.0.1 localhost localhost.localdomain pedrogarcez”. So my hosts file looks like this:

Your system has configured ‘manage_etc_hosts’ as True.

As a result, if you wish for changes to this file to persist

then you will need to either

a.) make changes to the master file in /etc/cloud/templates/hosts.tmpl

b.) change or remove the value of ‘manage_etc_hosts’ in

/etc/cloud/cloud.cfg or cloud-config from user-data

127.0.1.1 pedrogarcez pedrogarcez 127.0.0.1 localhost 127.0.0.1 localhost localhost.localdomain pedrogarcez

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 ff02::3 ip6-allhosts

  1. I ran the sendmail config using “sudo sendmailconfig” and answered ‘Y’ to everything.
Subscribe
Share

@ryanpq Im having the same issue, my hostfile looks like this:

Your system has configured ‘manage_etc_hosts’ as True.

As a result, if you wish for changes to this file to pers$

then you will need to either

a.) make changes to the master file in /etc/cloud/templat$

b.) change or remove the value of ‘manage_etc_hosts’ in

/etc/cloud/cloud.cfg or cloud-config from user-data

127.0.1.1 tinybird.localdomain tinybird 127.0.0.1 localhost

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 ff02::3 ip6-allhosts

I looked in my log file, and this is what i saw:

$ sudo cat /var/log/mail.log Dec 11 05:47:27 tinybird sendmail[6216]: gethostbyaddr(162.243.158.185) failed: 1 Dec 11 05:47:27 tinybird sendmail[6216]: gethostbyaddr(10.12.0.5) failed: 1 Dec 11 05:47:27 tinybird sendmail[6216]: alias database /etc/mail/aliases rebuilt by colin Dec 11 05:47:27 tinybird sendmail[6216]: /etc/mail/aliases: 0 aliases, longest 0 bytes, 0 bytes total Dec 11 05:47:27 tinybird sm-mta[6300]: gethostbyaddr(162.243.158.185) failed: 1 Dec 11 05:47:27 tinybird sm-mta[6300]: gethostbyaddr(10.12.0.5) failed: 1 Dec 11 05:47:27 tinybird sm-mta[6302]: starting daemon (8.15.2): SMTP+queueing@00:10:00

Is anything being recorded in /var/log/mail.log when this occurs? Checking the logs and backtracking from any errors that are recorded is usually the best way to start troubleshooting an issue like this.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

If sendmail is taking too long to send an email, try checking if port 25 is open on your Droplet. To do so, run the following command:

nc -vz smtp.gmail.com 25

If it returns a failure, please open a support ticket and the team will help you out. Otherwise, look at sendmail’s logs (usually located at /var/log/mail.log) and see if there’s anything there that could help you find out what’s wrong.