tags:

views:

15

answers:

1

Hey guys.

I'm searching for an "one-liner" for mailing within jsp. I just wanna send the values of 5 parameters to the webmasters mail-address. Any ideas for a short solution?

+1  A: 

More like a 6-liner, but you can use commons-email:

import org.apache.commons.mail.SimpleEmail;
...

  SimpleEmail email = new SimpleEmail();
  email.setHostName("mail.myserver.com");
  email.addTo("[email protected]", "John Doe");
  email.setFrom("[email protected]", "Me");
  email.setSubject("Test message");
  email.setMsg("This is a simple test of commons-email");
  email.send();
David Rabinowitz
Thanks! That's short enough ;)
shevron