Send mail using CDO

<%

set objMessage = createobject("cdo.message")
set objConfig = createobject("cdo.configuration")

' Setting the SMTP Server
Set Flds = objConfig.Fields
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
Flds.update


Set objMessage.Configuration = objConfig
objMessage.To = "you@YourHostedDomainName.com"
objMessage.From = "someone@somewhere.com"
objMessage.Subject = "This is a sample email sent using CDO"
objMessage.TextBody = "Congratulation" & VbCrLf & "If you receive this is, your mail component works"
objMessage.fields.update
objMessage.Send

Response.write "Mail sent..."

set objMessage = nothing
set objConfig = nothing

%>

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Redirect a subdomain to a subdirectory

You can redirect a subdomain to a subdirectory by using ASP or ASP.net code.When the requests are...

Query MySQL Database in ASP.net

<%@ Page Language="VB" %><%@ import Namespace="System.Data.Odbc" %><script...

Query MS SQL Database with PHP

Below is a simple PHP script to demonstrate how to connect to a MS SQL database using an ODBC...

Query an Access database with ASP using a DSN-less connection.

<%Dim cnnSimple  ' ADO connectionDim rstSimple  ' ADO recordsetSet cnnSimple =...

Query MS Access Database with OleDB in ASP.net

<%@ import namespace="system.data.oleDb" %><Script runat="server">Sub page_load Dim...