我有一个运行 Debian 稳定版的工作邮件服务器,以下元素正在工作。
- SPF
- 德基姆
- 域名系统
我的 IP 未在任何后备列表中列出,我使用:mxtoolbox.com 来完成这一切。
我的问题:使用 python 脚本向 hotmail 发送电子邮件有时不起作用。邮件已发送,但收件人没有收到(或进入垃圾邮件)。发送到我的帐户时不会发生这种情况,所以我什至不知道会发生什么。
这是脚本(也许我缺少一个标头?)考虑一下,目前安全性不是问题(我根本不检查参数)
#!/usr/bin/python
import sys
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
if len(sys.argv)!=3:
print "2 parameter, mail subject (quoted)"
sys.exit(1)
sender = '[email protected]'
receiver = sys.argv[1]
msg = MIMEMultipart('alternative')
msg['Subject'] = sys.argv[2]
msg['From'] = sender
msg['To'] = receiver
with open('mailtext', 'r') as content_file:
message= content_file.read()
msg.attach(MIMEText(message,'html'))
s = smtplib.SMTP('localhost')
s.sendmail(sender, receiver, msg.as_string())
s.quit()
这是我发送的邮件的 mail.log
Nov 10 14:20:59 domain postfix/smtpd[11743]: connect from domain.com.ar[127.0.0.1]
Nov 10 14:20:59 domain postfix/smtpd[11743]: 2668943282: client=domain.com.ar[127.0.0.1]
Nov 10 14:21:00 domain postfix/cleanup[11749]: 2668943282: message-id=
Nov 10 14:21:00 domain postfix/qmgr[4185]: 2668943282: from=, size=836, nrcpt=1 (queue active)
Nov 10 14:21:00 domain postfix/smtpd[11743]: disconnect from domain.com.ar[127.0.0.1]
Nov 10 14:21:04 domain postfix/smtpd[11761]: connect from domain.com.ar[127.0.0.1]
Nov 10 14:21:04 domain postfix/smtpd[11761]: 9F19843285: client=domain.com.ar[127.0.0.1]
Nov 10 14:21:04 domain postfix/cleanup[11749]: 9F19843285: message-id=
Nov 10 14:21:04 domain postfix/qmgr[4185]: 9F19843285: from=, size=1262, nrcpt=1 (queue active)
Nov 10 14:21:04 domain postfix/smtpd[11761]: disconnect from domain.com.ar[127.0.0.1]
Nov 10 14:21:04 domain amavis[10275]: (10275-15) Passed CLEAN {RelayedInternal}, MYNETS/MYUSERS LOCAL [127.0.0.1]:45027 [127.0.0.1] -> , Queue-ID: 2668943282, Message-ID: , mail_id: 16V7UTH-mVAO, Hits: -7.345, size: 835, queued_as: 9F19843285, 4471 ms
Nov 10 14:21:04 domain postfix/smtp[11756]: 2668943282: to=, relay=127.0.0.1[127.0.0.1]:10024, delay=5.6, delays=1.1/0.01/0.01/4.5, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 9F19843285)
Nov 10 14:21:04 domain postfix/qmgr[4185]: 2668943282: removed
Nov 10 14:21:06 domain postfix/smtp[11762]: 9F19843285: to=, relay=mx1.hotmail.com[65.54.188.94]:25, delay=1.4, delays=0.01/0.02/0.86/0.51, dsn=2.0.0, status=sent (250 Queued mail for delivery)
Nov 10 14:21:06 domain postfix/qmgr[4185]: 9F19843285: removed
我缺少什么明显的东西吗?