Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-19-2007, 06:15 AM   PM User | #1
cancer10
Regular Coder

 
Join Date: Jun 2006
Location: India
Posts: 795
Thanks: 210
Thanked 2 Times in 2 Posts
cancer10 can only hope to improve
Exclamation CDOSYS Error

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

Code:
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
__________________
http://outlineme.com/cancer10
cancer10 is offline   Reply With Quote
Old 05-21-2007, 03:29 PM   PM User | #2
Daemonspyre
Regular Coder

 
Join Date: Mar 2007
Posts: 505
Thanks: 1
Thanked 19 Times in 19 Posts
Daemonspyre is on a distinguished road
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

Code:
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.

Last edited by Daemonspyre; 05-21-2007 at 03:35 PM..
Daemonspyre is offline   Reply With Quote
Old 05-21-2007, 04:01 PM   PM User | #3
cancer10
Regular Coder

 
Join Date: Jun 2006
Location: India
Posts: 795
Thanks: 210
Thanked 2 Times in 2 Posts
cancer10 can only hope to improve
Exclamation

Now I am getting this error

Microsoft VBScript runtime error '800a01b6'

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

/mailtest.asp, line 4


Code:
 <%
     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

%>
__________________
http://outlineme.com/cancer10
cancer10 is offline   Reply With Quote
Old 05-21-2007, 04:03 PM   PM User | #4
Daemonspyre
Regular Coder

 
Join Date: Mar 2007
Posts: 505
Thanks: 1
Thanked 19 Times in 19 Posts
Daemonspyre is on a distinguished road
Ah, my fault -- myMail.SmtpServer

Case sensitivity...
Daemonspyre is offline   Reply With Quote
Old 05-21-2007, 04:07 PM   PM User | #5
cancer10
Regular Coder

 
Join Date: Jun 2006
Location: India
Posts: 795
Thanks: 210
Thanked 2 Times in 2 Posts
cancer10 can only hope to improve
Nope, Same error

Microsoft VBScript runtime error '800a01b6'

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

/mailtest.asp, line 4
__________________
http://outlineme.com/cancer10
cancer10 is offline   Reply With Quote
Old 05-21-2007, 04:18 PM   PM User | #6
Daemonspyre
Regular Coder

 
Join Date: Mar 2007
Posts: 505
Thanks: 1
Thanked 19 Times in 19 Posts
Daemonspyre is on a distinguished road
OK.. Google + Correct Search terms = your answer. Unfortunately, it's too long to post here, so here's URL:

http://classicasp.aspfaq.com/email/h...-with-cdo.html

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

Code:
<%
    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!
Daemonspyre is offline   Reply With Quote
Old 04-29-2009, 05:58 PM   PM User | #7
karlhungus
New to the CF scene

 
Join Date: Apr 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
karlhungus is an unknown quantity at this point
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
karlhungus is offline   Reply With Quote
Old 11-15-2011, 06:34 AM   PM User | #8
kavithaB
New to the CF scene

 
Join Date: Nov 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
kavithaB is an unknown quantity at this point
Question CDO.Message.1 error '80040213'.... The transport failed to connect to the server

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...
kavithaB is offline   Reply With Quote
Old 11-15-2011, 10:52 PM   PM User | #9
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,212
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:41 PM.


Advertisement
Log in to turn off these ads.