title: Recommended way to send email from a web app?
body: <p>I have a web app on JBoss 4.2.3 and I'd like it to send email. I could do something like:</p>
  
  <pre><code>try {
  Properties props = System.getProperties();
  props.put("mail.transport.protocol", "smtp" );
  props.put("mail.smtp.starttls.enable","false" );
  props.put("mail.smtp.host","smtp.somehost.com");
  props.put("mail.smtp.auth", "true" );
  Authenticator auth = new SMTPAuthenticator();
  Session session = Session.getInstance(props, auth);
  // -- Create a new message --
  Message msg = new MimeMessage(session);
  // -- Set the FROM and TO fields --
  msg.setFrom(new InternetAddress("me@somehost.com"));
  msg.setRecipients(Message.RecipientType.TO,
  InternetAddress.parse("recipient@somewhere.com", false));
  msg.setSubject("yadayada");
  msg.setText("Yada yada");
  // -- Set some other header information --
  msg.setHeader("MyMail", "Mr. XYZ" );
  msg.setSentDate(new Date());
  // -- Send the message --
  Transport.send(msg);
  }
  catch (Exception ex) {
    ex.printStackTrace();
    System.out.println("Exception "+ex);
  }
  </code></pre>
  
  <p>but it doesn't feel right. Will this scale?</p>