我用来将
用户名的/etc/aliases
传入电子邮件重定向到 python 脚本"ooo"
(经办SENDMAIL
)
ooo: "|/usr/bin/python /2/a.wsgi"
这就是它的a.wsgi
样子。
import os
import sys
a = sys.stdin.read(1024)
f = open('/2/email.txt','w')
f.write(a)
我从我的雅虎电子邮件帐户向自己发送了一封测试电子邮件,但整个标题和正文都不见了。
我故意创建了一个长标题,其中包含很多个 o 和一个由很多个 o 组成的正文,其中包含多行,以便我可以看到它。
当我通过 python 查看截获的电子邮件时。这就是 email.txt 文件的样子。
[root@a 2]# cat email.txt
From a*****@ymail.com Thu Jul 25 09:41:49 2013
Received: from nm23-vm1.bullet.mail.bf1.yahoo.com (nm23-vm1.bullet.mail.bf1.yahoo.com [98.139.213.141])
by domain.tld (8.14.4/8.14.4) with ESMTP id r6P9fm88005190
for <ooo@*****.tld>; Thu, 25 Jul 2013 09:41:48 GMT
Received: from [98.139.215.142] by nm23.bullet.mail.bf1.yahoo.com with NNFMP; 25 Jul 2013 17:26:26 -0000
Received: from [98.139.212.228] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 25 Jul 2013 17:26:26 -0000
Received: from [127.0.0.1] by omp1037.mail.bf1.yahoo.com with NNFMP; 25 Jul 2013 17:26:26 -0000
X-Yahoo-Newman-Property: ymail-3
X-Yahoo-Newman-Id: 45121.53358.bm@omp1037.mail.bf1.yahoo.com
Received: (qmail 29958 invoked by uid 60001); 25 Jul 2013 17:26:26 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s1024; t=1374773185; bh=Nc9zHE1K2q237s4A2qN53+4bWmq6BswfttyIcwmUsF8=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=tN89b5lX46otPfK9builCXVNLty3jVx[root@a 2]#
如您所见,主题是空的,主体也不可见。
否则我给自己发电子邮件
主题:oooooooooooooooooooooooooooooooooooooooo
主体:还有很多 o,但多行,所以很容易看到。