[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] mailer.py smtplib support

From: Matt Kraai <kraai_at_alumni.cmu.edu>
Date: 2003-01-10 02:27:51 CET

Howdy,

The following, untested patch adds rudimentary smtplib support to
mailer.py. I would appreciate it if someone would test it.

Matt

* tools/hook-scripts/mailer.py
  (main): Send mail with smtplib.

* tools/hook-scripts/mailer.conf.example
  (from_addr, to_addr): New.

Index: tools/hook-scripts/mailer.py
===================================================================
--- tools/hook-scripts/mailer.py (revision 4318)
+++ tools/hook-scripts/mailer.py (working copy)
@@ -13,6 +13,8 @@
 import string
 import ConfigParser
 import time
+import cStringIO
+import smtplib
 
 import svn.fs
 import svn.util
@@ -37,9 +39,11 @@
                                 1, # use_copy_history
                                 pool)
 
- ### pipe it to sendmail rather than stdout
- generate_content(sys.stdout, cfg, repos, editor, pool)
-
+ msg = cStringIO.cStringIO()
+ generate_content(msg, cfg, repos, editor, pool)
+ server = smtplib.SMTP()
+ server.sendmail(cfg.general.from_addr, [cfg.general.to_addr], msg.getvalue())
+ server.quit()
 
 def generate_content(output, cfg, repos, editor, pool):
 
Index: tools/hook-scripts/mailer.conf.example
===================================================================
--- tools/hook-scripts/mailer.conf.example (revision 4318)
+++ tools/hook-scripts/mailer.conf.example (working copy)
@@ -10,3 +10,8 @@
 ### know how I plan to allow the insertion of spaces)
 diff = /usr/bin/diff -u -L "%(label_from)s" -L "%(label_to)s" "%(from)s" "%(to)s"
 
+### the from address
+from_addr = foo@invalid
+
+### the to address
+to_addr = bar@invalid

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jan 10 02:28:52 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.