I am making a email submit form in html and the email is sent with Microsoft Outlook when user hit "submit". Here is my code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function sendMail() {
var link = "mailto:jshao745@gmail.com"
+ "&subject=" + encodeURIComponent (document.getElementById('subject').value)
+ "&body=" + encodeURIComponent (document.getElementById('body').value)
;
window.location.href = link;
}
</script>
<style>
textarea
{
resize: none;
}
</style>
</head>
<body>
subject:<br>
<input type="text" name="subject" id="subject"><br>
Type your message here:<br>
<textarea rows="4" cols="50" id="body">
This is a email testing.
</textarea>
<button onclick="sendMail(); return false">Send</button>
</body>
</html>
How do I make change so that the email is directory sent from webpage (or JSP to be exact) to my gmail without going through Outlook? I also try to add input field for sender's email address and name in the above form. I know I need to have a servlet for this to work.
I use java 7 and tomcat 7.0.
I appreciate if someone could help me.