I took these steps (from many posts on this forum and others) to install and configure SendMail on my DigitalOcean droplet, running Ubuntu 18.04.3 (LTS) x64, but I couldn't get it to work.
1. sendmail installed:
sudo apt-get install sendmail
2. changed the host name:
# sudo hostnamectl set-hostname coffee
# sudo nano /etc/hostname
3. modified the hosts file:
# sudo nano /etc/hosts
127.0.0.1 localhost.localdomain localhost
127.0.1.1 coffee.barismo.com coffee
::1 ip6-localhost ip6-loopback
4. Modified the local host names file:
# sudo nano /etc/mail/local-host-names
5. created a generic table:
sudo nano /etc/mail/genericstable
6. created a generic domain file:
sudo nano /etc/mail/generics-domains
7. added the following to sendmail.mc:
sudo nano /etc/mail/sendmail.mc
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl
8. and finally reconfigured sendmail and restarted the services and the server:
sudo systemctl restart sendmail
sudo service apache2 restart
sudo systemctl restart apache2
After all that, it still doesn't work.
When I tried to send a test email:
# echo "Subject: test" | /usr/lib/sendmail -v email@example.com
I get this error in email:
Jan 19 08:13:07 barismo sm-mta(25919): 00J837P9025919: to=,
ctladdr= (0/0), delay=00:10:00, xdelay=00:10:00,
mailer=esmtp, pri=30295, relay=alt4.gmail-smtp-in.l.google.com. (220.127.116.11),
dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
And when I tried to send me an email in my PHP script, I got this error:
Jan 19 08:10:43 barismo sm-mta(26115): 00J81emc025911: to=,
ctladdr= (33/33), delay=00:09:03, xdelay=00:04:22,
mailer=esmtp, pri=210494, relay=shared18.accountservergroup.com. (18.104.22.168),
dsn=4.0.0, stat=Deferred: Connection timed out with shared18.accountservergroup.com.
Where relevant, it should be noted that my domain DNS is hosted with Site5 and that I have only changed the record “ A & # 39; & # 39; to point to my Digital Ocean droplet, while keeping the “ MX & # 39; & # 39; with Site5 to manage mail.
I can still send and receive emails from my Site5 mailbox and the domain name itself (barismo.com and www.barismo.com) resolves correctly to my Digital Ocean droplet without problem.
Any direction will be greatly appreciated. Thank you.