ASP Jmail

Example ASP script for sending form mail using Jmail.

Form.asp :
<html>
<head>
<title> emailform </title>
</head>
<body>
<form method="post" action="sendmail.asp">
     Name <input name="name" type="text"><br>
     Email <input name="email" type="text"><br>
     Company <input name="company" type="text"><br>
     Occupation <select name="county">
     <option value="coder">Staffordshire
     <option value="coder">Shropshire
     <option value="coder">Lincolnshire
     </select><br>
     Favorite TV-show <textarea name="tv-show"></textarea><br>
     <input type="submit" value="Send">
</form>
</body>
</html>

Now create your mail script page...

Sendmail.asp:
<% smtp_server_address = "10.2.0.81"
On Error Resume Next
Response.Buffer = True
Set Jmail = Server.CreateOBject( "JMail.Message" )
Jmail.Logging = true
Jmail.Silent = true
JMail.From = "formresponse@yourdomain"
Jmail.AddRecipient "sales@yourdomain"
JMail.Subject = "Form Response"
'Doing things this way helps retain the form field order
For i = 1 to (Request.Form.Count)
     body = body & Request.Form.Key(i) & ": " & Request.Form.Item(i) & vbcrlf
Next
JMail.Body = Body
JMail.Priority = 1
If Not Jmail.Send(smtp_server_address) then
     ' There was an error - print the error log
     Response.write ("Error:<br>" & Jmail.log)
Else
     ' The message has been sent - redirect to confirmation page
     Set JMail = Nothing
     Response.Redirect "mail_sent.asp"
End If
Set JMail = Nothing %>

This script will work on all forms with as many fields as you wish. Parts in bold need to be changed to suit your needs. The SMTP server address can be viewed under the 'Properties' of your domain in the hosting controller. This page shows a working Jmail form that you can use to send e-mail anywhere, we also have another example that uses more of the properties of the message object and works in a different way... here.

News / Updates New version of cheque printing software is up. Can configure date in box. http://VirtualSplat.com/cp6.exe
E-mail : sales at virtualsplat dot com
Phone : +91 022 28067978