Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: Sending e-mails with CDONTS


Message #1 by "David Bibby" <dbibby@t...> on Thu, 1 Nov 2001 12:58:57
Hi All



I have a sample script below that I am using to test CDONTS on my machine.

I have successfully installed CDONTS and can reference it form a VB 

project.

However it fails to send an e-mail. A valid e-mail address is input but it 

doesn't send an e-mail.

Stepping through my VB project, no errors are caused.

I am logged in to Outlook 2000 on my machine although my outlook client is 

running in a different domain to the exchange server, but I have no 

problem sending e-mails myself using Outlook.

Has anyone any ideas of what my problem could be ?





SAMPLE CODE

___________

<%

Dim objMsg, strFrom, strTo, strSubject, strBody, lngImportance

strFrom = Trim(Request.Form("txtFrom"))

strTo = Trim(Request.Form("txtTo"))

strSubject = Trim(Request.Form("txtSubject"))

strBody = Trim(Request.Form("txtMessage"))

lngImportance = Trim(Request("optImportance"))



Set objMsg = Server.CreateObject("CDONTS.NewMail")



objMsg.From = strFrom

objMsg.To = strTo

objMsg.Subject = strSubject

objMsg.Body = strBody

objMsg.Importance = lngImportance

objMail.MailFormat = 0

objMail.BodyFormat = 0

objMsg.Send





Set objMsg = Nothing



WriteHTML("The following message was sent via CDONTS.  Please confirm that 

the message was received.")

WriteHTML("From: " &strFrom)

WriteHTML("To: " &strTo)

WriteHTML("Subject: " &strSubject)

WriteHTML("Importance: "&lngImportance)

WriteHTML("Body: " &strBody)

%>
Message #2 by "Patrick Frenette" <patrick.frenette@s...> on Fri, 2 Nov 2001 12:43:01
Hi there,



Two things.



First, make sure you type valid email adresses in both the To and From 

fields in order to send your email.



Secondo, You should have a look at CDO object if you are under Windows 

2000, it's a much more complete objet to send emails plus it's the one 

that's gonna be supported by Microsoft in the future...



Cheers



Patrick Frenette

Research Center for Geomatics

  Return to Index