[Twisted-Python] SMTP server

Jan Bakuwel jan.bakuwel at int.greenpeace.org
Thu Nov 9 05:44:55 MST 2006


Hoi all,

This is my first message to the list so I think its appropriate to
express my appreciation for all the excellent work done by the people
who created & contributed to the twisted libraries.

I have a small but interesting problem that I'd like to ask your advise
on, please see the description below. If you notice that I haven't
understood something properly, I hope you'll correct me :-)

I've implemented a SMTP server (I've called it "xsmtp") using the
twisted & python libraries. A MTA (Postfix) delivers email messages to
the xsmtp server: the MTA opens a single SMTP session to the xsmpt
server, then multiple "RCPT TO"s follow, one for each recipient.

As a result The "validateFrom" procedure is called by the twisted
library once, followed by multiple calls to the "validateTo" procedure.

This is creating a small problem for me. Since I must process the email
in the validateTo procedure, I will now receive multiple copies of the
same email (albeit for different recipients). One of the tasks of the
xsmtp server is to transmit these emails to another xsmtp server (SMTP
cannot be used due to the inherently high latency connection between the
two). Ideally I do not transfer the same email twice but would like to
leave the delivery to multiple recipients up to the MTA on the other
end. In a schema:

-> MTA -> xsmtp -- high latency link --> xsmtp -> MTA -> local delivery

To implement smtp.IMessageDelivery I have to provide for the following
procedures:

validateFrom:    called once shortly after SMTP session is initiated
receivedHeader:  called multiple times for each recipient
validateTo:      called multiple tiems for each recipient

One could say that "validateFrom" is the start of the process (of
receiving an email) "receivedHeader/validateTo" is the core of the
process. What I am missing is something that indicates the end of the
process.


It would help me tremendously if smtp.IMessageDelivery would also
provide an abstract method that is called once the message delivery is
completed.

Any suggestions, thoughts are very welcome; perhaps this is already
possible with the twisted libraries in a different way as I'm suggesting
here?

best regards,
Jan

-- 

"It is an illusion to think that we are free to apply our increasing
knowledge in any way we choose. In reality we are struggling to deal
with the consequences of it."                           -- John Gray

----

Electronic Technology Coordinator
Information/Communication/Technology
Greenpeace International
Ottho Heldringstraat 5
1066 AZ  AMSTERDAM
Netherlands (MET)

direct    +31 (0)20 7182084
fax       +31 (0)20 5148151
reception +31 (0)20 5148150
email     jan.bakuwel&int.greenpeace.org
private   jan.bakuwel&hccnet.nl
(replace & by @ in the emailaddress)





More information about the Twisted-Python mailing list