...

View Full Version : CDOSYS Error



phantom007
05-19-2007, 06:15 AM
I am trying to send an email using CDOSYS with classic ASP. But I am getting this error:


CDO.Message.1 error '80040220'

The "SendUsing" configuration value is invalid.

/send.asp, line 8

line1 <%
line2 Dim myMail
line3 Set myMail=CreateObject("CDO.Message")
line4 myMail.Subject="Sending email with CDO"
line5 myMail.From="from@domain.com"
line6 myMail.To="to@domain.com"
line7 myMail.TextBody="This is a message."
line8 myMail.Send
line9 set myMail=nothing
line10 %>


Can anyone plz help?

Thanx

Daemonspyre
05-21-2007, 03:29 PM
The SendUsing is throwing an error because (at least in the code snippet you gave us) you have not defined an SMTP server.

Try adding


myMail.SMTPServer = "mail.mycompany.com"

By default, if SmtpMail.SmtpServer is not set, System.Web.Mail is supposed to use localhost as the default property. However, for some reason this doesn't appear work. If you are using the local SMTP Service to send emails, you may try the following values:

"127.0.0.1"
"localhost"
"the_machine_name_here"
"the_real_dns_name_here"
"the_machine_IP_Address_here"

That should fix it.

phantom007
05-21-2007, 04:01 PM
Now I am getting this error

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'SMTPServer'

/mailtest.asp, line 4



<%
Dim myMail
Set myMail=CreateObject("CDO.Message")
myMail.SMTPServer = "mail.igchosting.com"
myMail.Subject="Sending email with CDO"
myMail.From="from@domain.com"
myMail.To="to@domain.com"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing

%>

Daemonspyre
05-21-2007, 04:03 PM
Ah, my fault -- myMail.SmtpServer

Case sensitivity...

phantom007
05-21-2007, 04:07 PM
Nope, Same error

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'SmtpServer'

/mailtest.asp, line 4

Daemonspyre
05-21-2007, 04:18 PM
OK.. Google + Correct Search terms = your answer. Unfortunately, it's too long to post here, so here's URL:

http://classicasp.aspfaq.com/email/how-do-i-send-e-mail-with-cdo.html

Basically, it adds a few lines of code to yours:



<%
sch = "http://schemas.microsoft.com/cdo/configuration/"

Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "mail.igchosting.com"
.update
End With

Set myMail = CreateObject("CDO.Message")

With myMail
Set .Configuration = cdoConfig
.From = "from@domain.com"
.To = "to@domain.com"
.Subject = "Sending email with CDO"
.TextBody = "This is a message."
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>


HTH!

karlhungus
04-29-2009, 05:58 PM
This worked for me:

dim Mailer
set Mailer = server.createobject("CDO.Message")
Mailer.From = "some@sender.com"
Mailer.To = "some@receipient.com"
Mailer.Subject = "some subject"
Mailer.TextBody = "some body"
with Mailer.Configuration
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.somedomain.com"
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Fields.Update
end with
Mailer.Send
set Mailer = Nothing

kavithaB
11-15-2011, 06:34 AM
Hi,
i have a problem when i am try to send mail.. Please see this below code..

Dim myMail
Set myMail = CreateObject("CDO.Message")

myMail.Subject = mailSubject
myMail.From = contactName & " <" & email & ">"
myMail.To = "info@osbornecharles.com"
myMail.TextBody = mailSubject & ""_
& VBCrLf & VBCrLf & "Site Action: " & siteAction & ""_
& VBCrLf & VBCrLf & "Contact Name: " & contactName & ""_
& VBCrLf & "Company Name: " & companyName & ""_
& VBCrLf & VBCrLf & "Address: " & VBCrLf & street & ""_
& VBCrLf & city & ", " & state & " " & zip & ""_
& VBCrLf & VBCrLf & "Phone: " & phone & ""_
& VBCrLf & "Email: " & email & ""_
& VBCrLf & "Website: " & website & ""_
& VBCrLf & VBCrLf & "Best Contact Time: " & bestContactTime & ""_
& VBCrLf & "Interested Software: " & business & ""_
& VBCrLf & VBCrLf & "Comments: " & VBCrLf & comments & VBCrLf


myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.osbornecharles.com"
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Update
myMail.Send
Set myMail = Nothing
%>

I am wondering for this error.. Let me know where i did a mistake...

Old Pedant
11-15-2011, 10:52 PM
Code looks fine. It might be that you need more configuration info to work with that server. (For example, some SMTP servers require username/password authentication.)

You need to check with the system administrator of that server.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum