我已经按照以下步骤来configurationsendmail
apt-get install sendmail 在/etc/mail/auth/client-info添加以下内容
AuthInfo:<gworks.yyy> "U:<[email protected]>" "I:<[email protected]>" "P:<xxxxxxx>"
sudo bash -c "cd /etc/mail/auth/ && makemap hash client-info < client-info" 在MAILER_DEFINITIONS之前添加/etc/mail/sendmail.mc的以下行
define( SMART_HOST', <gworks.yyy>)dnl define( confAUTH_MECHANISMS', EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl FEATURE( authinfo',`hash / etc / mail / auth / client-info')dnl
sudo bash -c "cd /etc/mail/ && m4 sendmail.mc > sendmail.cf" 用telnet命令testing
来自远程主机的telnet命令抛出错误中继被拒绝
root@e5eae2c464a7:/var/www/public# telnet 10.1.2.3 25 Trying 10.1.2.3... Connected to 10.1.2.3. Escape character is '^]'. 220 cthree.gworks.yyy ESMTP Sendmail 8.15.2/8.15.2/Debian-3; Tue, 11 Oct 2016 06:45:28 GMT; (No UCE/UBE) logging access from: development.internet(OK)-development.internet [10.1.2.4] helo server 250 cthree.gworks.mobi Hello development.internet [10.1.2.4], pleased to meet you mail from: [email protected] 250 2.1.0 [email protected]... Sender ok rcpt to: [email protected] 550 5.7.1 [email protected]... Relaying denied
我在这里做错了为什么不能从远程主机发送邮件?
Sendmail默认拒绝中继 (接受来自外部主机的邮件到外部电子邮件地址)。
您可以允许基于发送主机IP地址或SMTP AUTHentication之后进行中继。
要允许基于发送主机IPv4地址的中继,请在访问文件中使用以下条目之一(访问文件需要使用makemap编译):
# relay if connection from 10.1.2.4 connect:10.1.2.4 RELAY # relay if connection from 10.2.0.0/24 connect:10.2.0 RELAY # relay if connection from 10.3.0.0/16 connect:10.3 RELAY
警告 :恕我直言中继仅基于IP地址,没有任何额外的检查,适合作为永久的解决scheme,只为小型networking/网站。 垃圾邮件制造者和黑客使其不适合更大的networking。