我一直坐在这里几个小时,试图让sendmail通过外部SMTP服务器发送电子邮件。 我已经非常接近了,但现在我完全陷入了困境。 看来sendmail并没有发送我设置的authentication信息。 有没有一些configuration线我错过了?
请帮忙。 🙁
运行CentOS 5.7
编辑 :
按照要求,我会在这里添加sendmail的一些东西。
我在哪里指定使用身份validation信息:
FEATURE(authinfo',hash -o /etc/mail/auth/client-info.db')dnl
在/ etc /邮件/authentication/客户信息:
AuthInfo:in.mailjet.com "U:myusername" "P:mypassword" "M:PLAIN"
试图发送电子邮件:
# sendmail -AM -t -v to:[email protected] from:[email protected] . [email protected]... Connecting to in6.mailjet.com. via relay... 220 in6.mailjet.com ESMTP Mailjet >>> EHLO mydomain.com 250-in6.mailjet.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5 250-AUTH=PLAIN LOGIN DIGEST-MD5 CRAM-MD5 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN >>> STARTTLS 220 2.0.0 Ready to start TLS >>> EHLO mydomain.com 250-in6.mailjet.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5 250-AUTH=PLAIN LOGIN DIGEST-MD5 CRAM-MD5 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN >>> MAIL From:<[email protected]> SIZE=37 250 2.1.0 Ok >>> RCPT To:<[email protected]> >>> DATA 554 5.7.1 <[email protected]>: Relay access denied 554 5.5.1 Error: no valid recipients >>> RSET 250 2.0.0 Ok /root/dead.letter... Saved message in /root/dead.letter Closing connection to in6.mailjet.com. >>> QUIT 221 2.0.0 Bye
我遇到过同样的问题。 最后做了几个configuration。
/etc/mail/sendmail.mc define('SMART_HOST','smtp.yourdomain.com')dnl define('confAUTH_OPTIONS','A')dnl FEATURE('authinfo','hash -o /etc/mail/authinfo.db')dnl MASQUERADE_AS('yourdomain.com')dnl FEATURE(masquerade_envelope)dnl FEATURE(masquerade_entire_domain)dnl MASQUERADE_DOMAIN('yourdomain.com.')dnl FEATURE('relay_based_on_MX')dnl FEATURE('genericstable')dnl GENERICS_DOMAIN('localhost.localdomain')dnl /etc/mail/authinfo (660 permissions) Authinfo:yourdomain.com "U:yoursmtpuserid" "P:yourpassword" "M:PLAIN" Authinfo: "U:yoursmtpuserid" "P:yourpassword" "M:PLAIN" >makemap hash /etc/mail/authinfo < /etc/mail/authinfo /etc/mail/access (660 permissions) connect:localhost.localdomain RELAY connect:localhost RELAY connect:127.0.0.1 RELAY >makemap hash /etc/mail/access < /etc/mail/access /etc/genericstable root [email protected] >makemap hash /etc/mail/genericstable < /etc/mail/genericstable /etc/named.conf options{ listen-on port 53 {127.0.0.1;}; }; >cp -f /etc/named.conf /var/named/chroot/etc/ /etc/resolve.conf nameserver 127.0.0.1 nameserver youriplocal domain localdomain >chkconfig -> named on -> saslauthd on -> sendmail on >service named restart >service saslauthd restart >service sendmail restart
要testing它,你可以执行:
sendmail -Am -t -v:来自:youremail的emaildestination
我希望它适合你。
对于sendmail,我通常通过在/etc/mail/access添加一个条目来pipe理SMTP auth。 你的设置的一个简单的例子在这里:
# /etc/mail/access # by default we allow relaying from localhost... localhost.localdomain RELAY localhost RELAY 127.0.0.1 RELAY AuthInfo:in.mailjet.com "U:smmsp" "I:myusername" "P:mypassword" "M:PLAIN"
保存并重启sendmail守护进程, /sbin/service sendmail restart 。
你跑了:
makemap hash client-info < client-info
除非使用上述命令从文本生成client-info.db文件,否则sendmail不会读取其中的信息
编辑#1:
从蝙蝠书我复制:
当sendmail连接到另一个主机,并且其他主机提供authentication时,在数据库中查找连接到主机的IP地址,主机名和域。
如果未findIP地址,主机或域,则允许连接,但sendmail不会尝试对其进行身份validation。 否则,匹配右列中的信息将返回给sendmail使用。
您正在连接到in.mailjet.com,它是in.mailjet.com的MX。 所以也许你必须改变你的AuthInfo:行到:
AuthInfo:mailjet.com "U:myusername" "P:mypassword" "M:PLAIN"
编辑#2:
您在FEATURE(authinfo)声明中似乎有一个小错字:
FEATURE(`authinfo', `hash -o /etc/mail/auth/client-info.db')dnl
从functionauthinfo中删除-o(可选)并重新启动/重新加载sendmail。 这将使sendmail拒绝启动而不访问authinfo映射/文件。
FEATURE(`authinfo',`hash ...')
用跟踪地图查找重复发送testing邮件(包括跟踪authinfo地图查找)
sendmail -d60.5 -AM -t -v
sendmail是否查找authinfo条目? [回答应该缩小可能出现的问题列表]