Sending emails from a website using 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" ) = "smtp.yourdomainname.co.za"
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 smtp 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

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Sending email from ASP.Net

Sending E-mails from ASP.NetStep 1: Place the following in your web.config file, making sure to...

Sending mail with Joomla websites

1. Enter your Joomla dashboard. 2. Click on "Site", "Global configuration". 3. Choose the...

Sending smtp mail with wordpress

We do not allow any mails to be relayed without first authenticating to our mail servers,...

Sending email from asp pages

This portion goes into the header portion of the page before the  tag.   (Just remove the space...

Sending Email from PHP

Sending E-mail from PHP For Sending external emails from websites to to domains that do not...