james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Noel J. Bergman" <n...@devtech.com>
Subject RE: how hard is it to write a SMTP client?
Date Sun, 15 Jun 2003 22:45:27 GMT
> > Why would you need to write a replacement for JavaMail for
> > sending mail?

> I don't "need" to as much as I hanker to.

Have fun.

> But [JavaMail] seems a little less than user friendly, to the
> extent that I have used it.

I've coded simple SMTP transports by hand.  JavaMail seems perfectly
reasonable.  Assuming that you have a MimeMessage, the simplest code is:

  try { Transport.send(msg); } catch (MessagingException _) {}

The basic msgsendsample.java example is small, and handles SMTP errors.  But
it seems to me that if you try to accommodate all of the possibilities in
SMTP and MIME, you are going to end up with something quite close to

> As I recall it requires a Session (which seems silly in the context of a
> MTA)

A Session carries context information.  You need to keep it somewhere.  It
has more of a role with other types of transports than SMTP.

> and it sets a message Header or two in ways which you just have
> to discover

This can be more of an issue, although not really with the SMTP transport.
The irony of your complexity argument is that JavaMail tries to keep things
simple, and sometimes does too much by default.

But getting back to your first point, if you just want to write an SMTP
transport for fun, have fun.  :-)

	--- Noel

To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org

View raw message