ASP Hosting Top Header
Easy ASP Hosting Logo ASP.NET Hosting   Toll Free: (800) 579-1657
ASP Hosting Contact Information
Windows Hosting
         Home         Hosting         Domains         Support          Order Windows 2003 Hosting
Helm Hosting

JMail COM Object Sample

Jmail is the most popular and the fast way to send emails from your ASP enabled website. We are currently running the latest version (ver.4.1). More information can be found at

The following is a working sample of how this component works on Active Server hosting accounts. There are literally thousands of other combinations, colors, methods, etc that could be used to accomplish the same function. Please note that we do not provide support for this sample. It is only provided as a guide to help you get started.

All the ASP code is documented. What is not documented is the plain HTML tables which were added for aesthetic purposes.

Please note: When using any ASP Mail COM Objects, you must use the specific internal email IP address assigned to that server and "2525" as the port number. We configure SMTP on a non-routable, internal IP with an odd port number so that people can send email through ASP scripts, without having to deal with SMTP authentication issues. You can find out what IP address you should be using by clicking here.

This is what the ASP code looks like:

' Check to see if the "EmailTo" field as filled out, if it was, assume
' all other fields were filled out and try to send email
If Len(Request("EmailTo")) > 0 Then

' Instantiate the COM Object
Set Msg = Server.CreateOBject( "JMail.Message" )

' Set logging to true to ease any potential debugging
' And set silent to true as we wish to handle our errors ourself
Msg.Logging = True
Msg.Silent = True

' Most mailservers require a valid email address
' for the sender
Msg.From = Request("EmailFrom")
Msg.FromName = Request("EmailFromName")

' Next we have to add some recipients.
' The addRecipients method can be used multiple times.
' We skip the name the second time, it
'It is ptional to provide a name.
Msg.AddRecipient Request("EmailTo"), Request("EmailToName")

' The subject of the message
Msg.Subject = Request("Subject")

' The body property is both read and write.
' If you want to append text to the body you can
' use JMail.Body = JMail.Body & "Hello world! "
' or you can use JMail.AppendText "Hello World! "
' which in many cases is easier to use.
Msg.Body = Request("Body")

' To send the message, you use the Send()
' method, which takes one parameter that
' should be your mailservers address
' To capture any errors which might occur,
' we wrap the call in an IF statement
If Not Msg.Send("" ) then (this will change depending on which server your account resides on, click here to find out what IP address is assigned to your server.

          Response.write "<pre>" & Msg.Log & "</pre>"
          Response.write "Message sent succesfully!"
End If

' And we're done! the message has been sent.


<form name="form1">

                                 <td colspan="2"><b>JMail Sample</b></td>

                                 <td valign="top">Email From:</td>
                                 <td><input type="text" name="EmailFrom"></td>

                                 <td valign="top">Email From Name:</td>
                                 <td><input type="text" name="EmailFromName"></td>

                                 <td valign="top">Email To:</td>
                                 <td><input type="text" name="EmailTo"></td>

                                 <td valign="top">Email To Name:</td>
                                 <td><input type="text" name="EmailToName"></td>

                                 <td valign="top">Subject:</td>
                                 <td><input type="text" name="Subject"></td>

                                 <td valign="top">Body:</td>
                                 <td><textarea cols="40" rows="10" name="Body"></textarea></td>

                                 <td><input type="submit" value="Send Email"></td>

<%End If%>

And this is what it looks like in a web browser:


Home |  Hosting |  Resellers |  About Us |  Testimonials |  Site Map |  Contact Us |  Data Center |  Helm |  Support |  Announcements |  Order