1

I have taken these steps (gathered from numerous posts in this forum and others) to install and configure SendMail on my DigitalOcean droplet, running Ubuntu 18.04.3 (LTS) x64, but I have been unable to get it to work.

1. installed sendmail:

sudo apt-get install sendmail

2. changed the host name:

# sudo hostnamectl set-hostname coffee

# sudo nano /etc/hostname
coffee

# hostname
coffee

3. amended 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
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

4. amended the local host names file:

# sudo nano /etc/mail/local-host-names
localhost
coffee

5. created a generics table:

sudo nano /etc/mail/genericstable
www-data       webmaster@barismo.com
root           server@barismo.com

6. created a generics domains file:

sudo nano /etc/mail/generics-domains
barismo.com

7. added the following to sendmail.mc:

sudo nano /etc/mail/sendmail.mc
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl

8. and finally reconfigured sendmail and restarted the services and the server:

sudo sendmailconfig
sudo systemctl restart sendmail
sudo service apache2 restart
sudo systemctl restart apache2

After all this, it still doesn't work.

When I tried to send a test email:

# echo "Subject: test" | /usr/lib/sendmail -v isofia666@gmail.com

I get this error in mail.log:

Jan 19 08:13:07 barismo sm-mta[25919]: 00J837P9025919: to=<isofia666@gmail.com>, 
ctladdr=<root@coffee.barismo.com> (0/0), delay=00:10:00, xdelay=00:10:00, 
mailer=esmtp, pri=30295, relay=alt4.gmail-smtp-in.l.google.com. [172.253.112.27], 
dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.

And when I tried to send a mail to myself in my PHP script, I get this error:

Jan 19 08:10:43 barismo sm-mta[26115]: 00J81emc025911: to=<webmaster@barismo.com>, 
ctladdr=<www-data@coffee.barismo.com> (33/33), delay=00:09:03, xdelay=00:04:22, 
mailer=esmtp, pri=210494, relay=shared18.accountservergroup.com. [192.185.134.44], 
dsn=4.0.0, stat=Deferred: Connection timed out with shared18.accountservergroup.com.

In case it's relevant, it should be noted that my domain DNS is hosted with Site5 and I have altered only the 'A' record to point to my Digital Ocean droplet, while maintaining the 'MX' records with Site5 to handle mails.

I am still able to send and receive mails from my Site5 mailbox, and the domain name itself (barismo.com & www.barismo.com) resolves correctly to my Digital Ocean droplet without issue.

Any direction will be greatly appreciated. Thank you.

iSofia
  • 113
  • 1
  • 4
  • A connection timeout usually points toward a firewall problem. Most probably your hoster blocks outgoing mail connections to prevent spam abuse. – Gerald Schneider Jan 19 '20 at 11:10
  • [here](https://www.digitalocean.com/community/questions/smtp-timeout) and [here](https://stackoverflow.com/questions/27106336/smtp-mandrill-port-587-connection-timed-out) it is confirmed that DigitalOcean blocks outgoing mail connections. – Gerald Schneider Jan 19 '20 at 11:19

1 Answers1

2

DigitalOcean seems to block outgoing mail connections by default.

Quote from a DigitalOcean Community Manager on SO:

In order to curb spam and abuse, some new user accounts at DigitalOcean have their SMTP ports blocked by default. Unfortunately there are sometimes false positives. It sounds like this might have been the case for you. If you open a support ticket, the team would be happy to remove that block for you.

So, you need to open a support ticket.

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
  • Thank you for the info. I'll raise a support request now. Otherwise, does my configuration look in order to you? – iSofia Jan 19 '20 at 13:19
  • It was the SMTP port! They unblocked it and now it works. All the tweaking for naught. Thank you, Gerald. – iSofia Jan 20 '20 at 04:56