[Sussex] PHPSMTPD - tests anyone?

Ronan Chilvers ronan at thelittledot.com
Thu Sep 15 11:58:27 UTC 2005


Hi Steve

On Thu, 15 Sep 2005 12:26:14 +0100
Steve Dobson <steve at dobson.org> wrote:

> Ronan
> 
> On Thu, Sep 15, 2005 at 11:12:17AM +0100, Ronan Chilvers wrote:
> > I've recently been trying to find a PHP class to handle the MTA
> > side of an SMTP session in order to build a simple autoresponder.
> > Couldn't find one so I've put together one for myself.  I've used
> > it to build a simple email server which I've called phpsmtpd which
> > can accept mail and stores it in a spool directory on the local
> > filesystem.  It requires PHP5 since it uses tcp streams and
> > exceptions. Its intended as a quick and easy mail server for use
> > when testing scripts / email clients and (I think) speaks enough
> > SMTP to do this.
> > 
> > I'd be obliged if anyone who has a spare five minutes could grab the
> > archive and give it a run, maybe fire off some of their email
> > scripts at it and let me know what happens.  Particularly I'd be
> > interested to see if / how it runs on a windows system, since I
> > don't have access to a windows machine with PHP5 on it.  There's a
> > zip and bz2 tarball at the url below.
> > 
> > You can get it at
> > 
> > http://www.ronanchilvers.com/notes/phpsmtpd.html
> 
> I have to ask why?
> 
> I have configured exim4 (or sendmail or procmail, or ...) to just
> pipe the incoming email to a php process.  The php process scans
> the mail text and then works out what to do.  No need to do all
> that silly TCP streams - it would only need to read from standard in.

Partly as an exercise in coding it, partly because there's good mileage
in having an SMTP interface because its network aware.  TCP streams
aren't so silly if your auto responder is on a different machine
to your email server :-). Having a script talk SMTP is a very useful way
of giving it a machine independant interface.  For example amavis
(general purpose filtering software written in perl) uses an SMTP /
LMTP (if local) interface to the MTA.  Its cleaner, neater and more
extendable than the stdin option.

> 
> BTW: Looking at you page I would never use this as it uses SMTP AUTH 
> but only for PLAIN and LOGIN.  I would *never* use either of these as
> the passwords are transmitted in clear text.  CRAM-MD5 (RFC-2195) is
> by far the better option.

Agreed, but if you read a bit further down, you'll also see that the
SMTP AUTH requests always succeed.  SMTP AUTH support isn't intended to
be used 'in anger'.  Its in there to support client scripts who need to
use it and test that its working.  The SMTP AUTH requests are both
correctly parsed and handled, but the authentication doesn't actually
happen.  So for example, someone using PEAR::Mail can turn on SMTP AUTH
in their mail object (the mech is automagic in
PEAR::Mail).  The server emulates what the real one should do.  I may
add CRAM-MD5 to it but SMTP AUTH is there for convenience in this
implementation, not as a main feature.  Bear in mind that this is NOT
supposed to be a fully fledged mail server.  Its a test server,
designed to accept mail and then expose exactly what happened in the
SMTP transaction.  If I was using the SMTP class in an autoresponder I
wouldn't be using SMTP AUTH anyway (although you could I guess) - I'd
be more likely to develop lookup maps for acceptable email or
IP addresses.

Hope that answers the questions.  Cheers for the comments.

Ronan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20050915/87957168/attachment.pgp 


More information about the Sussex mailing list