New Special Offer: Web Hosting with FREE App Installer from £4.99/month. View Plans & Pricing

How to send an email using CDOSYS and classic ASP

My eCenica
My Profile
Support Messenger
Help & Support
Service Status
Orders & Invoices
My Services

Contents

  1. How to send an email using CDOSYS and classic ASP


1. How to send an email using CDOSYS and classic ASP

    Copy and paste the following code into your ASP page. Save and upload to your eCenica Web Space.

    <!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows Library" -->
    <!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->
    
    <%
    Dim oMail
    Dim iConf
    Dim Flds
        
    Set oMail = Server.CreateObject("CDO.Message")
    Set iConf = Server.CreateObject("CDO.Configuration")
        
    Set Flds = iConf.Fields
    With Flds
    .Item(cdoSendUsingMethod) = 2
    .Item(cdoSMTPServer) = "localhost"
    .Item(cdoSMTPServerPort) = 25
    .Item(cdoSMTPconnectiontimeout) = 10
    .Update
    End With
        
    Set oMail.Configuration = iConf
    
    'Send email to. 
    oMail.To = "user@domain.com"
    
    'Email subject...
    oMail.Subject = "This is the subject"
    
    'Send email from. This needs to be from your web site domain.
    oMail.From = "you@yourdomain.com"
    
    'Replay-to address. This needs to be from your web site domain.
    oMail.ReplyTo = "you@yourdomain.com"
        
    'Format email as 'HTML/Rich Format'  
    'oMail.HTMLBody = "this is the body"
    
    'Format email as 'Plain Text' 
    oMail.TextBody = "this is the body"
    
    'Send email
    oMail.Send
    
    ' Clean up variables.
    Set oMail = Nothing
    Set iConf = Nothing
    Set Flds = Nothing
    
    %>  

    ^ Top of page

Support Messenger Questions? Contact your eCenica Team today Login to My eCenica™