944,050 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 7778
  • ASP RSS
May 19th, 2007
0

CDOSYS Error

Expand Post »
I am trying to send an email using CDOSYS with classic ASP. But I am getting this error:

ASP Syntax (Toggle Plain Text)
  1. CDO.Message.1 error '80040220'
  2.  
  3. The "SendUsing" configuration value is invalid.
  4.  
  5. /send.asp, line 8
  6.  
  7. line1 <%
  8. line2 Dim myMail
  9. line3 Set myMail=CreateObject("CDO.Message")
  10. line4 myMail.Subject="Sending email with CDO"
  11. line5 myMail.From="from@domain.com"
  12. line6 myMail.To="to@domain.com"
  13. line7 myMail.TextBody="This is a message."
  14. line8 myMail.Send
  15. line9 set myMail=nothing
  16. line10 %>


Can anyone plz help?

Thanx
Similar Threads
Reputation Points: 58
Solved Threads: 1
Posting Whiz in Training
cancer10 is offline Offline
234 posts
since Dec 2004
Jun 7th, 2007
0

Re: CDOSYS Error - sending mail in asp using cdo

Try the following code from my AspLib-library of general asp-classes
and asp-functions:
asp Syntax (Toggle Plain Text)
  1. sub SendMail( byval psTo, byval psSubject , byval psBody )
  2. '______________________________________________________________________________
  3. '
  4. ' 'Send Mail'
  5. '______________________________________________________________________________}
  6. Dim iMsg
  7. Dim iConf,Flds
  8. if psTo = "" then Exit sub
  9. Set iMsg = CreateObject("CDO.Message")
  10. Set iConf = CreateObject("CDO.Configuration")
  11. Set Flds = iConf.Fields
  12. With Flds
  13. ' assume constants are defined within script file
  14. .Item("[url]http://schemas.microsoft.com/cdo/configuration/sendusing[/url]") = 2
  15. .Item("[url]http://schemas.microsoft.com/cdo/configuration/smtpserver[/url]") = <your relay server>
  16. .Item("[url]http://schemas.microsoft.com/cdo/configuration/smtpserverport[/url]") = 25
  17. .Update
  18. End With
  19. With iMsg
  20. Set .Configuration = iConf
  21. .To = psTo
  22. .From = "{#EmailContact}"
  23. .Subject = psSubject
  24. .ReplyTo = "{#EmailContact}"
  25. .BCC = "" ' "{#EmailContact}"
  26. '.Importance = cdoNormal
  27. 'For body text use either one of below
  28. '.TextBody = ''
  29. .HTMLBody= psBody
  30. '.CreateMHTMLBody "[url]http://www.w3schools.com/asp/[/url]"
  31. '.CreateMHTMLBody "[url]file://c:/mydocuments/test.htm[/url]
  32. '.AddAttachment "c:\mydocuments\test.txt"
  33. ' .MailFormat = 0 ' 0 for html - 1 for plain text
  34. ' .BodyFormat = 0 ' 0 for html - 1 for plain text
  35. .Send
  36. End With
  37. set iConf = Nothing
  38. set iMsg = Nothing
  39. end sub
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Sitestepper is offline Offline
6 posts
since May 2007
Nov 4th, 2009
0

CDO.Message.1 error '80040220'

Reputation Points: 10
Solved Threads: 0
Newbie Poster
shant1976 is offline Offline
1 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: ASP Error
Next Thread in ASP Forum Timeline: Need some help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC