Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: CDOSYS Error

  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts

    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

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    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.

  • #3
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts

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

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Ah, my fault -- myMail.SmtpServer

    Case sensitivity...

  • #5
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts
    Nope, Same error

    Microsoft VBScript runtime error '800a01b6'

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

    /mailtest.asp, line 4

  • #6
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    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!

  • #7
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #8
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,901
    Thanks
    79
    Thanked 4,423 Times in 4,388 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •