问题原文
原帖链接 · iSofia · CC BY-SA 4.0
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 [email omitted]
root [email omitted]
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 [email omitted]
I get this error in mail.log:
Jan 19 08:13:07 barismo sm-mta[25919]: 00J837P9025919: to=<[email omitted]>,
ctladdr=<[email omitted]> (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=<[email omitted]>,
ctladdr=<[email omitted]> (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.
已采纳解答
原帖链接 · Gerald Schneider · CC BY-SA 4.0
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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
