Score:0

Postfix simply send message to gmail, if ISP blocks port 587?

br flag

I cant get a simple test message out of my Ubuntu VM to my gmail for reporting.

I've followed several guides to set up an App Password in /etc/postfix/sasl_passwd, using port 587, disabled firewall, etc..

I can get internal messages to /var/mail/root. The log at /var/log/mail.log shows status=bounced (unknown user: . I have a feeling its because my server doesnt have an external IP or domain. Yet it can access apt update fine. Do I have to expose the IP externally somehow? Is there anyway to send out an email through the NAT of my Host machine?

/etc/postfix/main.cf

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128, xx.xx.xx.xx
...
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
#smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

/etc/postfix/sasl_passwd: [smtp.gmail.com]:587 [email protected]:xxxxxxx chmod 600 /etc/postfix/sasl_passwd

postmap /etc/postfix/sasl_passwd && systemctl reload postfix
mail [email protected] <<< "message"

I think I need to set to some IP: mynetworks =

dpkg-reconfigure postfix restarts the config wizard, and I read this "Mail is not delivered to external delivery agents as root." I wonder if I cant send it out as root.

Also, someone told me port 587 is blocked by many ISPs. I could test it with telnet my.domain 587, but I dont have a static IP or domain. I tried with my dynamic IP, but get "Connection timed out".

Guides:
https://www.systoolsgroup.com/add/postfix-to-gmail-account/ https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-20-04


I was able to get a message from my GCP instance. And the settings are basically the same. I think my ISP may be blocking port 587.

Score:0
br flag

It turns out GMail was sending messages to Spam and Trash. I tried using SendGrid and got better error messages in the log file. After setting the From, was able to get a 250 Delivered, and then went looking inside GMail. Both SendGrid and GMail smtps work now.

mydestination =
myorigin = a
smtp_sasl_security_options = noanonymous

For mail utility, if a subject is used, the -c switch needs to be used like mail -s "Disk Space Alert Used: $CURRENT" -c $EMAIL $EMAIL <<< $(hostname -i; uname -a)

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.