As I am using Amazon Lightsail and the port 25
is blocked by the provider, so I wanted to use port 587 to send email and use the emailing through my web app.
My /etc/postfix/master.cf
looks like this...
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (no) (never) (100)
# ==========================================================================
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
I think it's actually listening the port 587
netstat -na | grep LISTEN | grep 587
tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN
tcp6 0 0 ::1:587 :::* LISTEN
but... It's not sending email through the desired port 587
I tried sending a test email with this command...
echo "This is the body of the email" | mail -s "This is the subject line" myproperemail@gmail.com
But /var/log/mail.log
is saying something else...
Aug 6 00:54:44 deviser postfix/qmgr[765647]: 770F01B68AC: from=<ubuntu@deviser.club>, size=378, nrcpt=1 (queue active)
Aug 6 00:54:44 deviser postfix/error[765966]: 770F01B68AC: to=<myproperemail@gmail.com>, relay=none, delay=575, delays=575/0.01/0/0.01, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c16::1a]:25: Connection timed out)