You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Michael Davey <Mi...@coderage.org> on 2003/08/03 13:40:27 UTC

[email] SimpleEmail

Hi,

Ant has a MailMessage class that can be used like this:

// ----%<----
MailMessage msg = new MailMessage(mailhost, mailport);
msg.from("Ant Mail Message <Ma...@server.com>");
msg.to("to@you.com");
msg.setSubject("Test subject");

PrintStream out = msg.getPrintStream();
out.println( "test message line 1" );
out.println( "test message line 2" );

msg.sendAndClose();
// ----%<----


The important bit here is the out.println(). Perhaps something could be 
added to SimpleEmail to allow the message body to be built up line by 
line. Either a getPrintStream() method or perhaps an addMsg() method?

Also, I feel that there is scope within commons-email for a mail class 
that doesn't use JavaMail and performs a "best-efforts" mail delivery. 
 Indeed, this is pretty much what Ant's MailMessage class does.

-- 
Michael