Question

Postfix/SMTP Connection timed out

Posted June 8, 2021 626 views
ApacheEmailUbuntu 20.04e-commerce

Hey,

I’m a little frustrated and have no idea to solve this problem.
I can’t send or receive emails from my server/droplet.

I have a Ubuntu 20.04, postfix is running without errors.

My mail.log shows this:

...
postfix/smtp[1917]: connect to mx04.posteo.de[185.67.36.71]:25: Connection timed out
postfix/smtp[1918]: connect to mx04.posteo.de[185.67.36.64]:25: Connection timed out
postfix/smtp[1919]: connect to mx03.posteo.de[185.67.36.70]:25: Connection timed out
postfix/smtp[1920]: connect to mx-eu.mail.am0.yahoodns.net[188.125.72.74]:25: Connection timed out
postfix/smtp[1917]: connect to mx04.posteo.de[185.67.36.64]:25: Connection timed out
postfix/smtp[1915]: connect to mx01.posteo.de[185.67.36.61]:25: Connection timed out
postfix/smtp[1918]: connect to mx04.posteo.de[185.67.36.71]:25: Connection timed out
postfix/smtp[1920]: connect to mx-eu.mail.am0.yahoodns.net[188.125.72.73]:25: Connection timed out
postfix/smtp[1919]: connect to mx04.posteo.de[185.67.36.71]:25: Connection timed out
...

Currently, there are 5 emails in the mail queue.
(Just test mails)
It hasn’t worked before, so the server was never able to send a mail.

What I’m doing wrong?

postqueue -f       

=> No effect.

$ sudo ufw status verbose


Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW IN    Anywhere
80,443/tcp (Apache Full)   ALLOW IN    Anywhere
25/tcp                     ALLOW IN    Anywhere
465/tcp                    ALLOW IN    Anywhere
587/tcp                    ALLOW IN    Anywhere
22/tcp (v6)                ALLOW IN    Anywhere (v6)
80,443/tcp (Apache Full (v6)) ALLOW IN    Anywhere (v6)
25/tcp (v6)                ALLOW IN    Anywhere (v6)
465/tcp (v6)               ALLOW IN    Anywhere (v6)
587/tcp (v6)               ALLOW IN    Anywhere (v6)

Postfix main.cf:


# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2



# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache


smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = localhost
mydomain = homemade-shop.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, $mydomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = ipv4
home_mailbox = Maildir/

$ sudo service postfix status


● postfix.service - Postfix Mail Transport Agent
     Loaded: loaded (/lib/systemd/system/postfix.service; enabled; vendor preset: enabled)
     Active: active (exited) since Tue 2021-06-08 12:21:22 UTC; 18min ago
    Process: 3099 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
   Main PID: 3099 (code=exited, status=0/SUCCESS)

Jun 08 12:21:22 homemade-shop.com systemd[1]: Starting Postfix Mail Transport Agent...
Jun 08 12:21:22 homemade-shop.com systemd[1]: Finished Postfix Mail Transport Agent.

If you need more information, please let me know.
I’m trying to set up a Magento 2 Shop (manually installed, since one-click droplet hasn’t worked so far).
But an online shop that is not able to receive or send emails for instance password recovery or product orders is really useless to me.

I really would appreciate help in this case.

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.

×
Submit an Answer
1 answer

Hello @cryptogene,

It is possible that port 25 is closed for new accounts. This is something DigitalOcean has been doing to reduce spam on the network.

To qualify for the ability to send out emails, new accounts are required to wait 60 days before a request for removing the restriction could be raised. Once your account has reached 60 days of stable use, you could reach out to the DigitalOcean support team so they could look into this for you:

https://www.digitalocean.com/support/

In the meantime, you could instead use ports 465 or 587.

Hope that helps!
Regards,
Bobby