Concrete Mail CoreThis code enforces the basic statemachine that SMTP expects, switching between the various commands and finally results in forwarding on the SMTP command to the appropriate SMTP server. By itself, this can be used as a simple SMTP Proxy server. This class is a subclass of MailHandler, and as such largely consists of methods overriding methods from MailHandler which are designed to be overridden. Furthermore, it expects to forward any mail it accepts to another SMTP mail server, as transparently as possible. Thus this concrete mail core effectively forms the core of an SMTP proxy. NoteAs it stands however, by default this mail proxy will not forward any mails to the internal server. In order to change this, you would need to subclass this server and replace the method "shouldWeAcceptMail" since that defaults to returning False Example UsageAs noted, you are not expected to use this ConcreteMailHandler directly, but if you did, you would use it like this: ServerCore(protocol=ConcreteMailHandler, port=1025)
How does it work?As noted this overrides all the methods relating to handling SMTP commands, and enforces the state machine that SMTP requires. It's particularly strict about this, in breach of Postel's law for two reasons -
It was also primarily written in the context of a greylisting server.
Once the client has finished sending the data for an email, the proxy forwards the mail to the local real SMTP server. Fundamentally this happens by making a connection to the real server using the TCPClient component, and then replaying all the lines the original server sent us to the local server. (ie an inbox_log is built up with all data recieved from inbox "inbox" and then the contents of this are replayed when being sent to the local (real) SMTP mail server) ConfigurationThis class provides a large number of configuration options. You can either change this through subclassing or by providing as named arguments to the __init__ function. The options you have -
The following attributes get set when a client connects -
Kamaelia.Apps.Grey.ConcreteMailHandler.ConcreteMailHandlerclass ConcreteMailHandler(Kamaelia.Apps.Grey.MailHandler.MailHandler)Inboxes
Outboxes
Methods defined hereWarning! You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers. Methods inherited from Kamaelia.Apps.Grey.MailHandler.MailHandler :
FeedbackGot a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording! Please leave you feedback here in reply to the documentation thread in the Kamaelia blog. -- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT |
Kamaelia
is an open source project originated from and guided by BBC
Research. For more information browse the site or get in
contact.
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved.