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

Re: post commit hook and smtp authentication

From: Michael Wood <mwood_at_its.uct.ac.za>
Date: 2003-12-05 16:04:11 CET

On Thu, Nov 20, 2003 at 01:26:02PM +0100, nick vajberg wrote:
> What: I'm wanna use post-commit hooks on Linux to send
> mail on commits.
>
> Prob: My mail server can't send mail unless I log in.
> But I can't find a way to specify authentication (at
> least not in mailer.conf). Is there such a thing as
> smtp_username and smtp_password?

Here's a quick and dirty hack. I haven't tested it and you will need to
change 'user' to your username and 'password' to your password.
According to http://www.python.org/doc/current/lib/SMTP-objects.html
this should work. Of course it should catch the exceptions that might
be thrown and the parameters should not be hard coded, but I did say it
was quick and dirty ;)

Index: mailer.py
===================================================================
--- mailer.py (revision 7634)
+++ mailer.py (working copy)
@@ -194,6 +194,7 @@
 
   def finish(self):
     server = smtplib.SMTP(self.cfg.general.smtp_hostname)
+ server.login('user', 'password')
     server.sendmail(self.from_addr, [ self.to_addr ], self.buffer.getvalue())
     server.quit()
 

-- 
Michael Wood <mwood@its.uct.ac.za>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Dec 5 16:04:58 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.