[Twisted-Python] SMTP authentication

Phil Mayers p.mayers at imperial.ac.uk
Tue Jul 24 10:30:27 EDT 2012


On 24/07/12 15:00, Sarah Addis wrote:
> Sorry to be unhelpful in describing the issue. The password and username
> credentials are all correct. I am using BuildBot MailNotifier to send an
> email each time a build has taken place:

Ok, upon closer examination my recollection is incorrect; Twisted will 
always try CRAM-MD5 first.

As far as I can tell, you will need to sub-class the relevant classes 
and disable the CRAM-MD5 support. Sadly, this will require using an 
internal Twisted API, e.g.

from twisted.mail.smtp import ESMTPSender, ESMTPSenderFactory
from twisted.mail.smtp import LOGINAuthenticator, PLAINAuthenticator

class MyESMTP(ESMTPSender):
   def _registerAuthenticators(self):
      self.registerAuthenticator(LOGINAuthenticator(self.username))
      self.registerAuthenticator(PLAINAuthenticator(self.username))

# monkeypatch hack!
ESMTPSenderFactory.protocol = MyESMTP


This can be done more cleanly, of course.



More information about the Twisted-Python mailing list