[Twisted-Python] SMTP client patch

Anders Hammarquist iko at strakt.com
Thu Feb 27 04:11:06 EST 2003

In a message of Thu, 20 Feb 2003 22:37:08 CST, Glyph Lefkowitz writes:
>On Thursday, February 20, 2003, at 06:29 PM, Anders Hammarquist wrote:
>> In a message of Thu, 20 Feb 2003 16:14:31 CST, Glyph Lefkowitz writes:
>>> 1. it's not backwards compatible.  DocmaServer uses its own sendEmail,
>>> which depends on the sentEmail callback's signature.
>> way to find out what happend to failed recipient addresses. I
>> suppose I could add logic to try and detect an old-style sentEmail.
>Hmm... if you do that (with inspect or somesuch) please make sure to 
>spit out an ugly warning so that people will know to fix their code.  
>We shouldn't be supporting that long-term.


>>> I personally would like to see Twisted's sendEmail deprecated and
>> As in using sendmail plus the email module? Sure, will do.
>Actually I'd prefer the existing code not to be changed, but to spit 
>out a warning, since the interface ought to be "just pass a Message", 
>not "pass a bunch of crap that gets turned into a Message".  
>Considering how easy it is to turn a Message object into a long string, 
>I don't think a separate method is required for this...

Right, and I agree with you that the creation of the rfc-822-format
is not part of send(E)mail's job (which is why I wrote the sendmail
function in the first place). So I've added a deprecation warning
stating that you should consider changing your code to using the
email module and sendmail()

>As long as it's still maintained, though, the existing code should 
>remain in place rather than dragging a new dependency in for use with 
>2.1 (since 'email' is only in the stdlib since 2.2)

It's not much code (right now anyway, but it seems to be growing) so
it shouldn't be hard to keep it up to snuff in it's current state.

>>> 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.
>> ). My first look at t.p.log suggested not using it, since it dealt
>> mostly with syslog()-like logging.
>You're right.  Given this use-case though, it sounds like you need 
>little more beyond cStringIO...?

Well, I wanted to be able to limit the size of it, but apart from that
cStringIO would've done the job.

>t.p.log might not be the best place to put it, come to think of it, 
>since your impression of 'something like syslog' is correct.  But 
>somewhere in t.p in general.

I made it t.py.linelog. Feel free to change the name if you come
up with something better.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-patch
Size: 28840 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030227/0dbfdbc7/attachment.bin 

More information about the Twisted-Python mailing list