Sending Emails from Classic ASP

Sending E-mail from Classic ASP

Please use the following ASP code to send e-mails, note that our mail servers require SMTP authentication. The e-mail address that you are sending mail from must be created from within the control panel.

Dim ObjSendMail

Set ObjSendMail = CreateObject(
"CDO.Message" ) 'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item (
"http://schemas.microsoft.com/cdo/configuration/sendusing" ) = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item (
"http://schemas.microsoft.com/cdo/configuration/smtpserver" ) = "mail.reliablesite.net"
ObjSendMail.Configuration.Fields.Item ( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ) = 25
ObjSendMail.Configuration.Fields.Item (
"http://schemas.microsoft.com/cdo/configuration/smtpusessl" ) = False
ObjSendMail.Configuration.Fields.Item (
"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" ) = 60

' The mail server requires outgoing authentication use a valid email address and password.
ObjSendMail.Configuration.Fields.Item (
"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ) = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item (
"http://schemas.microsoft.com/cdo/configuration/sendusername" ) =" your_email@domain.com"
ObjSendMail.Configuration.Fields.Item ( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ) = "password"
ObjSendMail.Configuration.Fields.Update
'End remote SMTP server configuration section== ObjSendMail.To = "
sample@domain.com"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = " your_address@domain.com"

' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody =
"this is the body"
ObjSendMail.Send
Set ObjSendMail = Nothing

Add Feedback