Classic ASP send mail with CDOSYS in VBScript

Classic ASP send mail with CDOSYS in VBScript Sample Code

Note: your_domain_name.com is your actual domain name. name is your actual email address name. your_email_password is your actual email password.

 

 
  1. <!--
  2.     METADATA
  3.     TYPE="typelib"
  4.     UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"  
  5.     NAME="CDO for Windows 2000 Library"
  6. -->  
  7. <%  
  8.     Set cdoConfig = CreateObject("CDO.Configuration")  
  9.  
  10.     With cdoConfig.Fields  
  11.         .Item(cdoSendUsingMethod) = cdoSendUsingPort  
  12.         .Item(cdoSMTPServer) = "mail.your_domain_name.com"  
  13.         .Item(cdoSMTPAuthenticate) = 1
  14.         .Item(cdoSendUsername) = "name@your_domain_name.com"  
  15.         .Item(cdoSendPassword) = "your_email_password"
  16.         .Update  
  17.     End With
  18.  
  19.     Set cdoMessage = CreateObject("CDO.Message")  
  20.  
  21.     With cdoMessage
  22.         Set .Configuration = cdoConfig
  23.         .From = "name@your_domain_name.com"
  24.         .To = "name@your_domain_name.com"
  25.         .Subject = "CDOSYS Message"
  26.         .TextBody = "CDOSYS Message sent with SMTP Authentication"
  27.         .Send
  28.     End With
  29.  
  30.     Set cdoMessage = Nothing  
  31.     Set cdoConfig = Nothing
  32.  
  33. Response.write "Message Sent"
  34. %>

Add Feedback