override sender on sendmail invocation
authorMarius Mauch <genone@gentoo.org>
Sat, 10 Jun 2006 22:50:20 +0000 (22:50 -0000)
committerMarius Mauch <genone@gentoo.org>
Sat, 10 Jun 2006 22:50:20 +0000 (22:50 -0000)
svn path=/main/trunk/; revision=3486

pym/portage_mail.py

index 37bd11b64e1ed2b154e4b6cc1373f10d711b9192..54043e67455e0f15cba930bb77fcf2e120ebbe94 100644 (file)
@@ -61,16 +61,16 @@ def send_mail(mysettings, message):
        else:
                myrecipient = mysettings["PORTAGE_ELOG_MAILURI"]
        
+       myfrom = message.get("From")
+               
        # user wants to use a sendmail binary instead of smtp
        if mymailhost[0] == os.sep and os.path.exists(mymailhost):
-               fd = os.popen(mymailhost+" "+myrecipient, "w")
+               fd = os.popen(mymailhost+" -f "+myfrom+" "+myrecipient, "w")
                fd.write(mymessage.as_string())
                if fd.close() != None:
                        sys.stderr.write("!!! %s returned with a non-zero exit code. This generally indicates an error.\n" % mymailhost)
        else:
                try:
-                       myfrom = message.get("From")
-               
                        if int(mymailport) > 100000:
                                myconn = smtplib.SMTP(mymailhost, int(mymailport) - 100000)
                                myconn.starttls()