I wanted to send an e-mail from an ASP page that ran a very long and complex SQL query. This example uses the Collaboration Data objects (CDO) for ASP 2.0. Note that the CDO object is used, not the CDONTS object.
This example is for plain ASP:
Code:
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Application Table Update Complete at " & time()
myMail.From="ap-runner@mydomain.com"
myMail.To="administrator@mydomain.com"
myMail.TextBody="The update of the app tables is complete, including amendment transfer. Please run the table check to verify. "
' Fields use the microsoft schema
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
' Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="mysmtpserver.mydomain.com"
' SMTP Server port is usually 25
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
' Most SMTP servers will not allow relays without a valid user
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpaccountname") _
= "Bob Smith"
myMail.Configuration.Fields.Update
myMail.Send
%>
CDO.Message vs. CDONTS.NewMail
Microsoft has discontinued the use of CDONTs on Windows 2000, Windows XP and Windows 2003. If you have used CDONTs in your ASP applications, you should update the code and use the new CDO technology. If you are stuck with some code you are afraid to modify, you can use this Microsoft article for reference. Migrating CDONTS - Deploying IIS 6.0
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest (c) 2006 by Group29 Productions.
You can syndicate Group29 Productions news with an RSS Feeder using the file backend.php