Extending the server

Giganews Newsgroups
Subject: Extending the server
Posted by:  Tim Parker-Nance (tim_…@hotmail.com)
Date: Mon, 18 Jul 2005

We have been using the Indy TidSMTPServer component to develop an inhouse
mail server. The mail server sits on our network edge and scans for viruses,
spam, SPF and some other content based rules. The problem we are having is
that to get decent replies we have to change the Indy server code. That
means that every new snapshot needs to be checked and updated. Needless to
say it is not a very productive excercise.

I am am going to use SPF for a MailFrom extension as an example. What we are
do is extend the Indy types to handle our extra functionality. So we have:

  TIdMailFromReply = (mAccept, mReject, mRejectSPF);

And then:

    procedure MailFromRejectSPF(ASender: TIdCommand; const AAddress : String
= '');

And finally in the command handlers we check for our new types and call out
new methods.

To overcome this I suggest to extend your types by an element named Other
and an Event to set the response, so for example:

  TIdMailFromReply = (mAccept, mReject, mRejectOther);

In the MailFrom command handler you would then check for mRejectOther and if
found call a OnMailFromRejectOther event where we can set the Reply.

The same can be done for the ReceiptTo and Data commands. By doing this the
SMTP server becomes much more extendable with minimal changes to the Indy

Hope that helps