Use JMail


This section is designed to provide an overview of what you can do with JMail and to get you started using JMail. For detailed information on JMail, visit http://www.dimac.net.

The JMail component enables you to use ASP code to send and receive email (using POP and SMTP) from your ASP code or Windows programs.

Sample code

The following code illustrates using ASP and the JMail component to send the results of a simple form via email.

<%

Set JMail = Server.CreateObject("JMail.Message")

JMail.Logging = true

JMail.ISOEncodeHeaders = False

JMail.From = "username@domain.com"

JMail.FromName = "Test form"

JMail.Subject = "This is a Test of JMail" & now()

JMail.AddRecipient "recipient@domain.com","name"

JMail.Body = "this is a test" & now()

JMail.MailServerUserName = "username@domain.com"

JMail.MailServerPassWord  = "password"

JMail.Send("smtp.domain.com" )

if err.number <> 0 then

             response.write err.number & " " & err.description & "<Br>"

end if

response.write "JMail.ErrorCode: " & JMail.ErrorCode & "<br>"

response.write "JMail.ErrorMessage: " & JMail.ErrorMessage  & "<br>"

response.write "JMail.ErrorSource: " & JMail.ErrorSource  & "<br>"

response.write "JMail.Log: " & JMail.Log  & "<br>"

Set JMail = nothing

%>