Question

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?

Was it helpful?

Solution

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("jdoe@somewhere.org", "John Doe");
  email.setFrom("me@apache.org", "Me");
  email.setSubject("Test message");
  email.setMsg("This is a simple test of commons-email");
  email.send();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top