[Twisted-Python] SMTP client patch

Anders Hammarquist iko at cd.chalmers.se
Thu Feb 20 19:29:34 EST 2003

In a message of Thu, 20 Feb 2003 16:14:31 CST, Glyph Lefkowitz writes:
>I had a look at this patch with Itamar today.  We like where you're 
>going, but here are a few issues:
>1. it's not backwards compatible.  DocmaServer uses its own sendEmail, 
>which depends on the sentEmail callback's signature.

Yes, I know. The changes were needed to be able to get complete
status for the message delivery. With the old code there was no
way to find out what happend to failed recipient addresses. I
suppose I could add logic to try and detect an old-style sentEmail.

>I personally would like to see Twisted's sendEmail deprecated and 
>replaced with an admonishment to use the 'email' module ;), so it would 
>be nice if you could re-implement sendEmail in terms of your  MIME-less 
>'sendmail' function.

As in using sendmail plus the email module? Sure, will do.

>2. Those change to LineReceiver made no sense to us.  Care to explain?

Somewhere in the docs I read that returning (as opposed to raising)
an exception will land you in Factory.clientConnectionFailed with
that exception (wrapped in a failure). However, LineReceiver didn't
propagate the returned exceptions up to Protocol, so it didn't work
without those changes. smtpConnectionFailed and smtpTransferFailed
uses this.

>3. What's up with the SMTP logger?  and logging every line in the 
>client?  This is duplicated generic code, and should probably be 
>refactored into someplace more appropriate, like twisted.python.log.

I agree that it may be useful elsewhere (though expect it's use
will be rather limited). The purpose keeping the log is for
generating bounce messages (i.e. as sendmail says:

... while talking to foo.bar.org.:
>>> RCPT To:<spam at foo.bar.org>
<<< 550 User unknown
>>> RCPT To:<eggs at foo.bar.org>
<<< 450 Insufficient disk space

). My first look at t.p.log suggested not using it, since it dealt
mostly with syslog()-like logging. I'll have another look to see
if it fits with those logging functions, else I'll just rename it
to something more generic and let it live in t.p.log.


More information about the Twisted-Python mailing list