You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Michael Wood <mw...@its.uct.ac.za> on 2003/12/05 15:04:11 UTC

Re: post commit hook and smtp authentication

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 <mw...@its.uct.ac.za>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: post commit hook and smtp authentication

Posted by Michael Wood <mw...@its.uct.ac.za>.
On Fri, Dec 05, 2003 at 11:40:35AM -0500, mark benedetto king wrote:
> On Fri, Dec 05, 2003 at 05:04:11PM +0200, Michael Wood wrote:
> > On Thu, Nov 20, 2003 at 01:26:02PM +0100, nick vajberg wrote:
> > > 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.
> 
> Your hack would have worked.  No need to use it, though, since
> mailer.py got configurable SMTP AUTH support in r7834.

Yes, thanks.  Serves me right for reading old mail and replying before
checking if someone else had already fixed the problem :)

-- 
Michael Wood <mw...@its.uct.ac.za>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: post commit hook and smtp authentication

Posted by Michael Wood <mw...@its.uct.ac.za>.
On Fri, Dec 05, 2003 at 11:40:35AM -0500, mark benedetto king wrote:
> On Fri, Dec 05, 2003 at 05:04:11PM +0200, Michael Wood wrote:
> > On Thu, Nov 20, 2003 at 01:26:02PM +0100, nick vajberg wrote:
> > > 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.
> 
> Your hack would have worked.  No need to use it, though, since
> mailer.py got configurable SMTP AUTH support in r7834.

Yes, thanks.  Serves me right for reading old mail and replying before
checking if someone else had already fixed the problem :)

-- 
Michael Wood <mw...@its.uct.ac.za>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post commit hook and smtp authentication

Posted by mark benedetto king <mb...@lowlatency.com>.
On Fri, Dec 05, 2003 at 05:04:11PM +0200, Michael Wood wrote:
> On Thu, Nov 20, 2003 at 01:26:02PM +0100, nick vajberg wrote:
> > 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.

Your hack would have worked.  No need to use it, though, since
mailer.py got configurable SMTP AUTH support in r7834.

--ben


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: post commit hook and smtp authentication

Posted by mark benedetto king <mb...@lowlatency.com>.
On Fri, Dec 05, 2003 at 05:04:11PM +0200, Michael Wood wrote:
> On Thu, Nov 20, 2003 at 01:26:02PM +0100, nick vajberg wrote:
> > 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.

Your hack would have worked.  No need to use it, though, since
mailer.py got configurable SMTP AUTH support in r7834.

--ben


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org