Using JavaMail in a JSP

Next we look at what is necessary to send an email using JavaMail and JSP. For our JSP example, we are going to use an HTML form to submit the mail message and a JSP to parse and send the submitted message. The HTML form can be found in Listing 17.2.

Code Listing 17.2. MailForm.html
 <html> <head> <title>JavaMail Form</title> </head> <body> <form action="/purejsp/MailExample.jsp" method="post"> <table cellspacing="2" cellpadding="2" border="1"> <tr> <td>To:</td> <td> <input type="text" name="to" size="30" maxlength="30"> </td> </tr> <tr> <td>From:</td> <td> <input type="text" name="from" size="30" maxlength="30"> </td> </tr> <tr> <td>Subject</td> <td> <input type="text" name="subject" size="30" maxlength="30"> </td> ...

Get Pure Java Server Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.