I am working on a web project using Tomcat 6 as my webserver and JSP as frontend. I want to send a mail from the web server to an email account. How can I achieve this?
To start, here is my form in JSP:
<form name="forgotpassword" onsubmit="return valid()">
<table>
<tr>
<td>Enter Employee ID</td>
<td><input type="text" name="emp_id" size="50"/></td>
</tr>
<tr>
<td>Enter Your Email Address</td>
<td><input type="text" name="mailid" size="50"/></td>
</tr>
<tr>
<td><input type="submit"style="margin-left:100px" name="forgot" value="SUBMIT"> <input type="reset" name="cancel" value="RESET"/></td>
</tr>
</table>
</form>
Using Java-Mail API.
This is simplest way, using MailToURLConnection. No additional libraries needed.
This works fine (gmail example) :