Sample Jmail Form Mail ASP Script
Open up your favourite editor, and cut and paste the following form email script
into it. Save it as form_email.asp and if you have Jmail installed locally visit
the page on your local server. Otherwise upload it to your webserver and visit it
there.
You'll find a form that will work a little like an e-mail client and send e-mail
with a given priority, recipient, subject, body, sender name, request receipt...
etc...
If you have the form locally, use your ISP's SMTP mail server (i.e. mail.freeserve.net)
for the Server entry, otherwise use the IP of your webserver (please request this information from support if you do not know it).
<%@LANGUAGE="VBSCRIPT"%>
<html><head></head>
<body>
<%
If Request.Form("Server") <> "" Then
On Error Resume Next
'Tells server to wait until all scripts on this page are processed before
'responding to client
Response.Buffer = TRUE
Set Jmail = Server.CreateObject( "JMail.Message" )
'Enable logging
Jmail.Logging = TRUE
'JMail will not throw exceptions. Message.send() will return TRUE or FALSE
'depending on the success of the operation.
Jmail.Silent = TRUE
Jmail.ReturnReceipt = Request.Form("Receipt")
JMail.From = Request.Form("Sender")
Jmail.FromName = "Exahost"
Jmail.ReplyTo = Request.Form("ReplyTo")
Jmail.AddRecipient Request.Form("Recipient")
JMail.Subject = Request.Form("Subject")
JMail.Body = Request.Form("Body")
'Priority 1=Urgent, 3=Normal, 5=Lowest
JMail.Priority = CInt(Request.Form("Priority"))
If Not Jmail.Send(Request.Form("Server")) Then
' There was an error - print the error log
%>
<p><%=Jmail.log%></p>
<%
Else
%>
<p>Mail Sent!</p>
<p>Log Reads: <%=Jmail.log%></p>
<%
End If
Set JMail = Nothing
End if
%>
<form name="jmail" method="post" action="">
<table border="0" align="center">
<tr>
<td align="right">Server:</td>
<td> <input name="Server" type="text" value="10.2.0.81"></td>
</tr>
<tr>
<td align="right">Priority:</td>
<td><select name="Priority">
<option value="1">Urgent</option>
<option value="3" selected="selected">Normal</option>
<option value="5">Low</option>
</select></td>
</tr>
<tr>
<td align="right">Receipt?:</td>
<td><select name="Receipt">
<option value="1">Yes</option>
<option value="0" selected="selected">No</option></select></td>
</tr>
<tr>
<td align="right">Sender :</td>
<td> <input name="Sender" type="text" value="somone@somewhere.com"></td>
</tr>
<tr>
<td align="right">From Name:</td>
<td><input name="FromName" type="text" value="Your Name"></td>
</tr>
<tr>
<td align="right">Reply To:</td>
<td><input name="ReplyTo" type="text" value="your@email.co.uk"></td>
</tr>
<tr>
<td align="right">Recipient:</td>
<td><input name="Recipient" type="text"
value="recipient@email.co.uk"></td>
</tr>
<tr>
<td align="right">Subject:</td>
<td><input name="Subject" type="text" value="Subject Line"></td>
</tr>
<tr>
<td align="right">Body:</td>
<td><textarea name="Body">Hi,
The body of the message goes in here!</textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="Submit" type="submit"
value="Send E-Mail!"></td>
</tr>
</table>
</form>
</body>
</html>