Score:0

Send An E-mail To A GMAIL Address From Linux Mail Command Using Postfix As The MTA

cx flag

I am a beginner in configuring mail delivery systems. Recently, orders came from the management that we need to send confirmation emails to our clients whenever they complete their applications (I work at a local college).

Upon scrambling good ol' Google for answers, I found this article at DigitalOcean on how to configure a 'send-only' Postfix (https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-22-04), which is exactly what I need since the parameters of the orders from the management is that the emails should be no-replies.

I found no hiccups on following the instructions in the said link, EXCEPT:

Apr 16 08:53:03 application postfix/pickup[360142]: DA25140A2775: uid=0 from=<[email protected]>
Apr 16 08:53:03 application postfix/cleanup[360716]: DA25140A2775: message-id=<[email protected]>
Apr 16 08:53:03 application postfix/qmgr[360143]: DA25140A2775: from=<[email protected]>, size=415, nrcpt=1 (queue active)
Apr 16 08:53:34 application postfix/smtp[360718]: connect to gmail-smtp-in.l.google.com[74.125.204.27]:25: Connection timed out
Apr 16 08:53:49 application postfix/smtp[360718]: connect to alt1.gmail-smtp-in.l.google.com[142.250.141.26]:25: No route to host
Apr 16 08:54:04 application postfix/smtp[360718]: connect to alt2.gmail-smtp-in.l.google.com[142.250.115.27]:25: No route to host
Apr 16 08:54:34 application postfix/smtp[360718]: connect to alt3.gmail-smtp-in.l.google.com[64.233.171.27]:25: Connection timed out
Apr 16 08:55:04 application postfix/smtp[360718]: connect to alt4.gmail-smtp-in.l.google.com[142.250.152.26]:25: Connection timed out
Apr 16 08:55:04 application postfix/smtp[360718]: DA25140A2775: to=<[email protected]>, relay=none, delay=121, delays=0.46/0.01/121/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[142.250.152.26]:25: Connection timed out)

... which I found on the system log after running the test command indicated in the instructions. (I altered the domain and the email address for privacy purposes.)

My Postfix Configuration is:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 3.6
smtpd_tls_cert_file=/etc/letsencrypt/live/college.ph/cert.pem
smtpd_tls_key_file=/etc/letsencrypt/live/college.ph/privkey.pem
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 = college.ph
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = college.ph
relayhost =
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = ipv4
mynetworks = 127.0.0.1/32

By the way, I configured Postfix to listen on port 3000/TCP since our ISP blocks the shit out of port 25. Port-forwarding, as well as SPF and DMARC is in place.

What am I doing wrong? Thank you very much in advance.

Score:2
in flag

It's doesn't matter what you configure postfix to listen to, Gmail and other mail services listen on port 25. If your ISP blocks it you can't send mail.

You can try to circumvent this by setting smtp_tls_security_level to yes, but then sending mail to mail services which are not configured for encryption will fail.

Basically you have two options, ask your hoster to open port 25 or switch to a different hoster.

Minmin avatar
cx flag
Thank you sir, will talk to the ISP I guess. :)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.