community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1741986 - /comdev/reporter.apache.org/trunk/scripts/sendmail.py
Date Mon, 02 May 2016 14:47:13 GMT
Author: sebb
Date: Mon May  2 14:47:13 2016
New Revision: 1741986

URL: http://svn.apache.org/viewvc?rev=1741986&view=rev
Log:
Change sender; use constants

Modified:
    comdev/reporter.apache.org/trunk/scripts/sendmail.py

Modified: comdev/reporter.apache.org/trunk/scripts/sendmail.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/sendmail.py?rev=1741986&r1=1741985&r2=1741986&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/sendmail.py (original)
+++ comdev/reporter.apache.org/trunk/scripts/sendmail.py Mon May  2 14:47:13 2016
@@ -4,12 +4,18 @@ import smtplib
 # Import the email modules we'll need
 from email.mime.text import MIMEText
 
-def sendMail(subject, body='', recipients='Site Development <site-dev@apache.org>',
sender='no-reply@reporter.apache.org', port=25):
+__SENDER__ = 'Reporter <apsite@apache.org>'
+__RECIPIENTS__ = 'Site Development <site-dev@apache.org>'
+__REPLY_TO__ = 'site-dev@apache.org'
+
+def sendMail(subject, body='', recipients=__RECIPIENTS__, sender=__SENDER__, port=25, replyTo=__REPLY_TO__):
     # Create a text/plain message
     msg = MIMEText(body)
     msg['Subject'] = subject
     msg['From'] = sender
     msg['To'] = recipients
+    if replyTo != None:
+        msg['Reply-To'] = replyTo
     smtp = smtplib.SMTP('localhost', port)
     smtp.sendmail(sender, [recipients], msg.as_string())
     smtp.quit()
@@ -17,7 +23,7 @@ def sendMail(subject, body='', recipient
 if __name__ == '__main__':
     # for testing locally:
     # sudo postfix start # MacoxX
-    # or start a debug server => need to change the SMTP port above
+    # or start a debug server => need to change the SMTP port
     # python -m smtpd -n -c DebuggingServer localhost:1025
     sendMail('Test message, please ignore', "Thanks!")
     print("Sent")
\ No newline at end of file



Mime
View raw message