我正在配置我的服务器以使用中继服务器发送邮件。我在 /etc/mail/sendmail.mc 中进行了以下输入
define(`SMART_HOST', `corprelay.example.com')dnl
MASQUERADE_AS(`example.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
systemctl restart sendmail
我在邮件日志中收到以下错误,并且邮件被推迟:
Sep 28 08:00:51 ve4-fsdb-l-p01 sendmail[3242]: 18SC0pTv003242: from=ram, size=229, class=0, nrcpts=1, msgid=<[email protected]>, relay=ram@localhost
Sep 28 08:00:51 ve4-fsdb-l-p01 sendmail[3243]: 18SC0peL003243: from=<[email protected]>, size=521, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Sep 28 08:00:51 ve4-fsdb-l-p01 sendmail[3242]: 18SC0pTv003242: [email protected], ctladdr=ram (1011/1011), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30229, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (18SC0peL003243 Message accepted for delivery)
Sep 28 08:05:51 ve4-fsdb-l-p01 sendmail[3245]: 18SC0peL003243: timeout waiting for input from corprelay.example.com. during client greeting
Sep 28 08:05:51 ve4-fsdb-l-p01 sendmail[3245]: 18SC0peL003243: to=<[email protected]>, ctladdr=<[email protected]> (1011/1011), delay=00:05:00, xdelay=00:05:00, mailer=relay, pri=120521, relay=corprelay.example.com. [20.11.7.5], dsn=4.0.0, stat=Deferred: Connection timed out with corprelay.example.com.
注意:IP 和主机名是虚拟的。
感谢致敬
答案1
防火墙阻止了 sendmail 通信。一旦为端口 25 设置了防火墙规则,sendmail 便开始工作。令人惊讶的是,我能够在端口 25 上进行 telnet,但在防火墙允许之前,我无法使用 telnet 发送邮件。