CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2012
    Posts
    1

    Error 80040211 9 in 10 times

    Hi,

    I have recently moved an application from a windows 2000 machine (IIS5) to a windows 2008 R2 machine (IIS6). All has gone smoothly, we have some legacy applications that were using CDONTS to send email, which we've rewritten to send via CDOSYS. Below is a sample of the code:
    Mail = Server.CreateObject("CDO.Message")
    Mail.From = rReply
    Mail.To = Addr
    Mail.Subject = rName
    Mail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
    Mail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.star.co.uk"
    Mail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
    Mail.Configuration.Fields.Item _
    ("http://schema.microsoft.com/cdo/configuration/smtpconnectiontimeout")=60
    Mail.Configuration.Fields.Update
    if Addr <> "" then
    Mail.Send
    End if
    Set Mail = nothing

    Now 9 in 10 times this works. The other times it generates a 80040211 error with no text. The SMTP does not require authentication and didn't require any when using CDONTS.

    So what have I tried thus far:
    1. Sending an email from the machine using telnet. I can access the port, send an email without any blocks.
    2. Alerting the error out (if err.number <> 0 etc etc). There does not appear to be any exception to error out.
    3. The elusive 1000 line limit - I've got it to insert a VBCRLF after each HTML tag

    The problem is, its not reliable. We use this app for sending out bulk emails and it keeps falling over.

    Any suggestions from anyone?

    Thanks
    J

  2. #2
    Join Date
    Jun 2009
    Posts
    113

    Re: Error 80040211 9 in 10 times

    When I've used ASP to do emailing I've usually done it this way:

    <code>
    Set cdoConfig = CreateObject("CDO.Configuration")
    With cdoConfig.Fields
    .Item(sch & "sendusing") = 2
    .Item(sch & "smtpserver") = "smtp.star.co.uk"
    .Item(sch & "smtpserverport") = 25
    .Item(sch & "smtpauthenticate") = 0
    .Update
    End With

    Set cdoMessage = CreateObject("CDO.Message")
    With cdoMessage
    Set .Configuration = cdoConfig
    .From = rReply
    .To = Addr
    .Subject = rName
    .HTMLBody = "<a>Hello World</a>"
    .MimeFormatted = True
    .Fields.Update
    End With

    If Addr <> "" Then
    cdoMessage.Send
    End If
    Set Mail = nothing

    </code>

    So separating out the configuration to a different object. It's been working fine on 2008 but I've not been doing bulk emailing with this. You can leave out the MimeFormatted if you want; I've only got that for embedded images.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured