I am new to twisted, so I am still trying to grasp how to work with
twisted in the first place. Right now, what I am trying to do, is to
write some type of smtp proxy.
What I need is a program that will listen for SMTP connections, and will
intercept the SMTP commands, so that I can, for example:
- choose from a list of smtp servers to proxy to, based on the from and
to addresses (and maybe get this info from a database)
- send the mail I am currently receiving to the elected proxy or deny
the mail attempt entirely
- do some other types of checking
Can anyone please guide me on how I can write such a program?
PD: I have looked at some of the classes in twisted, but I just cannot
make out which one is best for this. At first I have tried to use the
portforward.Proxy class in order to write a simple proxy, but later on I
found this would not let me choose to which server I want to connect to,
but I was required to predefine the ip of the server.
Later on I looked directly at the smtp.SMTP class and somehow got to
manage a skeleton for my program, but I was stuck at not knowing how to
forward the mail I was already receiving to the elected server.
I also found the mail.MailService class, although I think this is a
little too much for my purposes (but I am not sure for what this class
is intended, since it also includes a pop3 and imap4 server, I think)