sendmail - Incoming E-mail intercepted by PYTHON's ( sys.stdin.read(1024) ) is missing title and body content -
i use /etc/aliases
redirect incoming emails
username "ooo"
python script
( handled sendmail
)
ooo: "|/usr/bin/python /2/a.wsgi"
this a.wsgi
looks like.
import os import sys = sys.stdin.read(1024) f = open('/2/email.txt','w') f.write(a)
i sent test e-mail myself yahoo e-mail account whole title , body missing.
on purpose created long title consisting of lot's of o's , body consisting of lot's of o's multiple lines see it.
when intercepted e-mail python.. email.txt file looks like.
[root@a 2]# cat email.txt a*****@ymail.com thu jul 25 09:41:49 2013 received: nm23-vm1.bullet.mail.bf1.yahoo.com (nm23-vm1.bullet.mail.bf1.yahoo.com [98.139.213.141]) domain.tld (8.14.4/8.14.4) esmtp id r6p9fm88005190 <ooo@*****.tld>; thu, 25 jul 2013 09:41:48 gmt received: [98.139.215.142] nm23.bullet.mail.bf1.yahoo.com nnfmp; 25 jul 2013 17:26:26 -0000 received: [98.139.212.228] tm13.bullet.mail.bf1.yahoo.com nnfmp; 25 jul 2013 17:26:26 -0000 received: [127.0.0.1] omp1037.mail.bf1.yahoo.com 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 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]#
as can see subject empty , body not visible either.
otherwise e-mailed myself
subject: oooooooooooooooooooooooooooooooooooooooooo
body : lot's of o's multiple lines it'd easy see.
a = sys.stdin.read(1024)
reads no more 1024 bytes. length of email.txt you've posted. discrepancy due redactions.
so, if want entire message, use
a = sys.stdin.read()
Comments
Post a Comment