[ServerA+postfix] --relay email--> [mailserver+companydomain.com] --send email--> ([email protected])
I need to set up an email alert sent from ServerA to the intended recipients mainly residing in the company domain. To achieve that, I installed Postfix in ServerA to relay the email to an external SMTP server and send the email to the users. I've configured the Postfix to relay the email but when i test sending email, the connection to SMTP server was timed out.
var/log/ mail.log
Jul 12 09:01:48 localhost postfix/postfix-script[7261]: starting the Postfix mail system
Jul 12 09:01:48 localhost postfix/master[7263]: daemon started -- version 3.5.18, configuration /etc/postfix
Jul 12 09:02:50 localhost postfix/pickup[7265]: 05568200EA: uid=0 from=<[email protected]>
Jul 12 09:02:50 localhost postfix/cleanup[7291]: 05568200EA: message-id=<[email protected]>
Jul 12 09:02:50 localhost postfix/qmgr[7266]: 05568200EA: from=<[email protected]>, size=376, nrcpt=1 (queue active)
Jul 12 09:03:21 localhost postfix/smtp[7293]: connect to smtp.server.com[server.ip.add]:587: Connection timed out
Jul 12 09:03:21 localhost postfix/smtp[7293]: 05568200EA: to=<[email protected]>, relay=none, delay=31, delays=0.02/0.03/31/0, dsn=4.4.1, status=deferred (connect to smtp.server.com[server.ip.add]:587: Connection timed out)
Jul 12 09:06:48 localhost postfix/qmgr[7266]: D366720278: from=<[email protected]>, size=376, nrcpt=1 (queue active)
Jul 12 09:07:18 localhost postfix/smtp[7360]: connect to smtp.server.com[server.ip.add]:587: Connection timed out
Jul 12 09:07:18 localhost postfix/smtp[7360]: D366720278: to=<[email protected]>, relay=none, delay=585, delays=554/0.02/31/0, dsn=4.4.1, status=deferred (connect to smtp.server.com[server.ip.add]:587: Connection timed out)
/etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
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.members.linode.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost.members.linode.com, debian, localhost, localhost.localdomain, localhost
relayhost = [smtp.server.com]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
#edited lines
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
sasl_passwd
[smtp.server.com] [email protected]:password
Version:
postfix (3.5.18-0+deb11u1)
mailutils (1:3.10-3+b1)
I add the relayhost to point to SMTP server on port 587, then add multiple lines at the bottom to configure for the certificates. i also created a hash file for password authentication based on this article.
I was able to ping the mailserver from ServerA, but failed when telnet to mailserver on port 587 & 25. So i suspect this might be the port issue.
My concern is, what are need to be configured on the mailserver to make this to work?