我们在Debian上设置了exim4作为智能主机,通过Google的邮件服务器发送邮件。 我们使用谷歌应用程序的一切,所以这是有道理的。 问题是,智能主机帐户的密码已更改,导致exim将消息弹回,然后冻结它们。 现在,我在/var/spool/exim4/[input|msglog]收集了大量未发送的邮件。
我试过跑步了:
exim -d -M 1Mx6IS-0006bC-3h
但是这会导致反弹的消息被发送,而不是原来的。 我可以在/var/spool/exim4/input/1Mx6IS-0006bC-3h-D下面看到原始邮件的副本
------ This is a copy of the message, including all the headers. ------
…但我还没有想出一个方法来采取这个冻结反弹的消息,并将其转换回原来的消息,所以可以重试。
有任何想法吗?
UNTESTED!
这是一个Python脚本,应该做你想做的。 这是彻底的未经testing,并保证不在任何情况下工作。 如果你不懂Python,那么不要介意,对我来说这是一个很好的练习。
import os import smtplib import email mydir = os.open("/mydir") server = smtplib.SMTP() files = [mydir + "/" + f for f in os.listdir(mydir) if os.path.isfile(mydir + "/" + f)] while files: f = files.pop() msg = email.message_from_file(open(f)) body = msg.get_payload().split("------ This is a copy of the message, including all the headers. ------")[1].strip() from_addr = msg["To"] to_addr = msg["X-Failed-Recipients"] print "Sending message to ", to_addr server.send(from_addr, to_addr, body) print "Message sent"
这是最后的反弹吗? 或者那个说另外一个企图交付的企图会在几个小时内发生,如果以后,这两个消息是否会被发送出去,原来的和反弹呢? 既然这两个人都在排队,就我的理解你的问题。