来自python程序的sendmail

| 在下面的代码中,从系统发送的邮件将转到用户的垃圾邮件文件夹,下面给出python代码。我怀疑发件人的发件人为root @。 如何纠正这个
  def sendmail(to,fr,subject,msg):
     sendmail_location = \"/usr/sbin/sendmail\" # sendmail location
     p = os.popen(\"%s -t\" % sendmail_location, \"w\")
     p.write(\"From: %s\\n\" % fr)
     p.write(\"Reply-to: %s\\n\" % fr)
     p.write(\"To: %s\\n\" % to)
     p.write(\"Content-type: text/html\\n\")
     p.write(\"Subject: %s\\n\" % subject)
     p.write(\"\\n\") # blank line separating headers from body
     p.write(msg)
     status = p.close()
The mail format received in the
     Delivered-To: harry@8767@gmail.com
     Received: by 19.143.162.8 with SMTP id k6gm828f7tfe;
             Tue, 19 Apr 2011 22:42:17 -0700 (PDT)
     Received: by 10.68.9.168 with SMTP id a5try030f516pbb.481.1303278137028;
             Tue, 19 Apr 2011 22:42:17 -0700 (PDT)
     Return-Path: <root@.>
     Received: from  ([174.1.161.204])
             by mx.google.com with ESMTPS id v4si18etrt0pbr.108.2011.04.19.22.42.15
             (version=TLSv1/SSLv3 cipher=OTHER);
             Tue, 19 Apr 2011 22:42:15 -0700 (PDT)
     Received-SPF: neutral (google.com: 74.3.161.204 is neither permitted nor denied by best guess record for domain of root@.) client-ip=74.3.161.204;
     Authentication-Results: mx.google.com; spf=neutral (google.com: 174.1.161.204 is neither permitted nor denied by best guess record for domain of root@.) smtp.mail=root@.
     Received: (qmail 23122 invoked by uid 0); 19 Apr 2011 22:36:27 -0000
     Date: 19 Apr 2011 22:36:27 -0000
     Message-ID: <2010041954235627.25121.qmail@>
     From: admin@xxxxxx.com
     Subject: hi
已邀请:
为什么直接使用sendmail二进制文件??? Python有一个不错的smtplib模块,用于通过任意邮件服务器发送邮件 电子邮件模块,用于编写符合RFC-822的正确邮件。 不建议您在做什么。

要回复问题请先登录注册