[Twisted-Python] Do Twisted support LMTP servers?

Simon Hedberg simon at hedberg.net
Tue Apr 18 07:22:26 MDT 2006


Jesus Cea wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Twisted is very extensive in protocol support, managing smtp, pop3
> and imap4, for example. I was wondering if there is any LMTP server
> project out there. It should be fairly simple, since LMTP is very
> very similar to usual SMTP. I need to use LMTP for a local project,
> and I was wondering if tiwsted could be used to fill this gap.    
> 
> - --
> Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
> jcea at argo.es http://www.argo.es/~jcea/ _/_/    _/_/  _/_/    _/_/ 
> _/_/ 
> jabber / xmpp:jcea at jabber.org         _/_/    _/_/          _/_/_/_/_/
>                                _/_/  _/_/    _/_/          _/_/  _/_/
> "Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
> "My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
> "El amor es poner tu felicidad en la felicidad de otro" - Leibniz

Hi,
I have been looking at ways to have postfix talking to my twisted app
and today tried LMTP successfully for the first time. What I've done so
far is just subclass the ESMTP protocol and add do_LHLO which seems to
do the trick for some basic usage at least. Looking at
http://www.ietf.org/rfc/rfc2033.txt it seems like it shouldn't be to
hard to make a proper LMTP implementation. Perhaps someone more familiar
with twisted.mail could have a look.


class LMTP(smtp.ESMTP):
    def do_LHLO(self, rest):
        peer = self.transport.getPeer()
        try:
            host = peer.host
        except AttributeError:
            host = str(peer)
        self._helo = (rest, host)
        self._from = None
        self._to = []
        self.sendCode(250, '%s Hello %s, nice to meet you\n%s' %
(self.host, host,self.listExtensions()))

    def do_HELO(self,rest):
        return self.do_UNKNOWN(self,rest)
    def do_EHLO(self,rest):
        return self.do_UNKNOWN(self,rest)





More information about the Twisted-Python mailing list