Outlook Email CDO

Gettingbetter

Well-known Member
Joined
Oct 12, 2004
Messages
602
I am trying to send an email without having to click yes in Outlook (I also don't want to use auto click yes).

Im guessing CDO is my best bet, however when I run the below
Code:
Sub MailCDO()
    Dim iMsg As Object
    Dim iConf As Object
    Dim strbody As String
    '    Dim Flds As Variant
 
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
 
        iConf.Load -1    ' CDO Source Defaults
        Set Flds = iConf.Fields
        With Flds
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "NE-EXCH"
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
            .Update
        End With
 
    strbody = "Hi there"
    
    With iMsg
        Set .Configuration = iConf
        .To = "Name@emailaddress"
        .CC = ""
        .BCC = ""
        .From = "Name@emailaddress"
        .Subject = "Important message"
        .TextBody = strbody
        .Send
    End With
 
    Set iMsg = Nothing
    Set iConf = Nothing
End Sub
I get the following Error message,

Run-Time Error '-2147220975 (80040211)':
The message could not be sent to the SMTP server. The error code was 0x800ccc15. The server responce was not available.

Does any one know how to fix this. Maybe my SMTP server is wrong (does anyone know how to get this???)
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,224,905
Messages
6,181,662
Members
453,059
Latest member
jkevin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top