Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDO - Excel 2007 Transport Error

Status
Not open for further replies.

rogerte

Programmer
Nov 9, 2001
164
GB
Hi.
We have an excel 2007 that emails out PDF invoices. It uses CDO code that has been working fine for the last 2 years using gmail as the email system.

We have now changed to our own website address, and have changed the parameters to those required by the ISP. Have tried ports 25, 465 and 587, but always get the same error:

CDO.Message.1 error '80040213'
The transport failed to connect to the server.


The OS is win10, the local pc has not changed.

Can send mail out on that account using Thunderbird as local client, which has the same smpt account details and port details (465)



Code:
    If IsEmailValid(eMailAddress) Then
    
        ' Email section starts here
        '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        Set iMsg = CreateObject("CDO.Message")
        Set iConf = CreateObject("CDO.Configuration")

        iConf.Load -1
        Set Flds = iConf.Fields
        With Flds
            .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpusessl")[/URL] = True
            .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")[/URL] = cdoBasic
            .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusername")[/URL] = "treasurer@xxxxxxxx.org.uk"
            .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendpassword")[/URL] = "password_goes_here"
            .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "smtp.xxxxxxxx.org.uk"
            .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = cdoSendUsingPort
            .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 587
            .Update
        End With
        
        strbody = "line1" & vbNewLine & vbNewLine _
                  & "line2" & vbNewLine & vbNewLine _
                  & "line3" & vbNewLine & vbNewLine _
        With iMsg
            Set .Configuration = iConf
            .To = Worksheets("Unpaid General Fees").Range("R" & i).Value
            .CC = ""
            .BCC = ""
            .From = "treasurer@xxxxxxxx.org.uk"
            .Subject = "Invoice for " & Worksheets("Unpaid General Fees").Range("B" & i).Value & (Resent)
            .TextBody = strbody
            .AddAttachment folder + "\" + pdfName
            .Send
        End With
        '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        ' Email section ends here
        
        Set iMsg = Nothing
        Set iConf = Nothing
        Worksheets("Unpaid General Fees").Range("T" & i).Value = "eMailed"

    Else
        Worksheets("Unpaid General Fees").Range("T" & i).Value = "To Be Posted"
    End If
  End If
 
It appears the ISP instructions about the server to use were incorrect.

I raised a question with them, and they have come back to apologise and to release a new instruction set.

Now works ok.

Thanks for interest, but, "nothing to see here"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top