<%@ page language=
"java"
contentType=
"text/html; charset=ISO-8859-1"
pageEncoding=
"ISO-8859-1"
%>
<html>
<head>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=ISO-8859-1"
>
<meta name=
"robots"
content=
"noindex,nofollow"
/>
<title>HTML email using Apache Commons API</title>
<link rel=
"stylesheet"
href=
"/resources/themes/master.css"
type=
"text/css"
/>
<link rel=
"stylesheet"
href=
"/resources/themes/jquery.wysiwyg.css"
type=
"text/css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
/>
<script
type=
"text/javascript"
></script>
<script
type=
"text/javascript"
></script>
<script
type=
"text/javascript"
></script>
<script src=
"/resources/scripts/mysamplecode.js"
type=
"text/javascript"
></script>
<script type=
"text/javascript"
src=
"/resources/scripts/jquery.wysiwyg.js"
></script>
<script type=
"text/javascript"
>
$(document).ready(
function
() {
$(
"#samplecode"
).validate({
rules: {
mailServer:
"required"
,
fromName:
"required"
,
fromEmail:
"required"
,
toName:
"required"
,
toEmail:
"required"
,
subject:
"required"
,
password: {
required:
function
(element) {
return
$.trim($(
"#userId"
).val()) !=
''
;
}
}
}
});
$(
function
(){
$(
'#messageBody'
).wysiwyg();
$(
'#messageBody'
).wysiwyg(
'clear'
);
});
});
</script>
</head>
<body>
<div id=
"allContent"
>
<%@include file=
"/header.jsp"
%>
<div id=
"myContent"
>
<div>
<%
boolean success =
false
;
if
(request.getAttribute(
"success"
) !=
null
){
success = (Boolean) request.getAttribute(
"success"
);
}
if
(success){
%>
<font color=
"green"
>
<b><br/>Thank you! You message has been sent.</b>
<br/>
</font>
<%
}
else
{
if
(request.getAttribute(
"success"
) !=
null
){
%>
<font color=
"red"
>
<b><br/>Error! You message was not sent.</b>
<br/>
</font>
<%
}
}
%>
</div>
<form id=
"samplecode"
name=
"samplecode"
method=
"POST"
action=
"<%= request.getContextPath() %>/SendHTMLEmail"
>
<fieldset>
<legend><b> HTML
Email using Apache Commons
API </b></legend>
<table>
<tr>
<td>
<label
for
=
"mailServer"
> Mail Server Host Name </label>
</td>
<td>
<input id=
"mailServer"
type=
"text"
name=
"mailServer"
size=
"50"
value=
"smtp.gmail.com"
/>
</td>
</tr>
<tr>
<td>
<label
for
=
"userId"
> Mail Server User Id </label>
</td>
<td>
<input id=
"userId"
type=
"text"
name=
"userId"
size=
"30"
value=
""
/>
<i>(In
case
your mail server needs Authentication)</i>
</td>
</tr>
<tr>
<td>
<label
for
=
"password"
> Mail Server Password </label>
</td>
<td>
<input id=
"password"
type=
"password"
name=
"password"
size=
"30"
value=
""
/>
<i>(In
case
your mail server needs Authentication)</i>
</td>
</tr>
<tr>
<td colspan=
"2"
>
</td>
</tr>
<tr>
<td>
<label
for
=
"fromName"
> Sender
's Name </label>
</td>
<td>
<input id="fromName" type="text" name="fromName" size="30" value=""/>
</td>
</tr>
<tr>
<td>
<label for="fromEmail"> Sender'
s Email Address </label>
</td>
<td>
<input id=
"fromEmail"
type=
"text"
name=
"fromEmail"
size=
"50"
value=
""
/>
</td>
</tr>
<tr>
<td>
<label
for
=
"toName"
> Recipient
's Name </label>
</td>
<td>
<input id="toName" type="text" name="toName" size="30" value=""/>
</td>
</tr>
<tr>
<td>
<label for="toEmail"> Recipient'
s Email Address </label>
</td>
<td>
<input id=
"toEmail"
type=
"text"
name=
"toEmail"
size=
"50"
value=
""
/>
</td>
</tr>
<tr>
<td colspan=
"2"
>
</td>
</tr>
<tr>
<td>
<label
for
=
"subject"
> Subject </label>
</td>
<td>
<input id=
"subject"
type=
"text"
name=
"subject"
size=
"50"
value=
""
/>
</td>
</tr>
<tr>
<td class=
"formText"
>
<label
for
=
"messageBody"
> Message </label>
</td>
<td>
<textarea id=
"messageBody"
name=
"messageBody"
rows=
"10"
cols=
"100"
maxlength=
"1000"
></textarea>
</td>
</tr>
<tr>
<td class=
"formText"
>
</td>
<td>
<input id=
"sendEmail"
type=
"submit"
value=
"Send my Email"
/>
</td>
</tr>
</table>
</fieldset>
</form>
</div>
</div>
<%@include file=
"/footer.jsp"
%>
<div></div>
</body>
</html>