In an ideal universe, there should be a file type that when associated
with an email program uses that file to send an email. The file would
contain the headers and text of the message. Then all you would have
to do is create such a file e.g. xxxx.email and then exec it and let
he OS deliver it to the default email program.
Perhaps how about setting up an interface for sending a mail via the
local mail client. In many cases this is what you want for ease of
configuring and for a permanent record of the outgoing message.
It can then be implemented with JNI on various platforms for the major
email clients. Worse comes to worse the implementation just steals
the configuration info from the client and sends via Javamail.
It might even look just like JavaMail, but with a different Transport.
This way you can easily offer both options with the same code or
change your mind later with ease.
If you defined the interface and implemented even one client in JNI in
one platform, you might start a trend.
you would build the message same as in JavaMail, with code like this:
Session session = Session.getDefaultInstance( props, null );
session.setDebug( CustConfig.debugging );
MimeMessage sm = new MimeMessage( session );
sm.setSentDate( new java.util.Date() /* now */ );
sm.setFrom( from );
Address[] replyTos = rm.getReplyTo();
if ( replyTos != null && replyTos.length > 0 )
{
sm.setReplyTo( replyTos );
}
sm.setRecipient( Message.RecipientType.TO,"(e-mail address removed)");
sm.setHeader( "X-Mailer","Canadian Mind Products bulk mailer" );
sm.setSubject( subject );
...
// new gismo, everything else just like JavaMail.
Transport transport = new LocalMailClientTransport();
transport.sendMessage( sm );
tranport.close();
A hitch is Transport is a class not an interface, which means you have
to carry the baggage of an actual Transport in
LocalmailClientTransport.