![需要在电子邮件服务器上进行哪些设置才能接受来自安装在 diff VM 上的 postfix 的中继电子邮件](https://linux22.com/image/787510/%E9%9C%80%E8%A6%81%E5%9C%A8%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E8%BF%9B%E8%A1%8C%E5%93%AA%E4%BA%9B%E8%AE%BE%E7%BD%AE%E6%89%8D%E8%83%BD%E6%8E%A5%E5%8F%97%E6%9D%A5%E8%87%AA%E5%AE%89%E8%A3%85%E5%9C%A8%20diff%20VM%20%E4%B8%8A%E7%9A%84%20postfix%20%E7%9A%84%E4%B8%AD%E7%BB%A7%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6.png)
[ServerA+postfix] --中继电子邮件--> [mailserver+companydomain.com] --发送电子邮件--> ([电子邮件保护])
我需要设置从 ServerA 发送到主要位于公司域中的预期收件人的电子邮件警报。为此,我在 ServerA 中安装了 Postfix,以将电子邮件转发到外部 SMTP 服务器并将电子邮件发送给用户。我已将 Postfix 配置为转发电子邮件,但当我测试发送电子邮件时,与 SMTP 服务器的连接超时。
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 密码
[smtp.server.com] [email protected]:password
版本:postfix(3.5.18-0+deb11u1)mailutils(1:3.10-3+b1)
我添加了中继主机以指向端口 587 上的 SMTP 服务器,然后在底部添加多行以配置证书。我还创建了一个基于以下文件的哈希文件,用于密码验证:这文章。
我能够从 ServerA ping 邮件服务器,但是在端口 587 和 25 上通过 telnet 连接到邮件服务器时失败。所以我怀疑这可能是端口问题。
我担心的是,需要在邮件服务器上进行哪些配置才能使其正常工作?