Send email via Microsoft Access using SMTP code through Office 365 email RRS feed

  • Question

  • Here is the test code with the Office 365 email settings.  I am receiving the error: The transport failed to connect to the server.

    Please review the settings and the code below and advise.   Thankyou

        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
            Set Flds = iConf.Fields
            With Flds
                .Item("") = 2
                .Item("") = "" 
                .Item("") = 25 
                .Item("") = 1
                .Item("") = ""
                .Item("") = mypassword
                .Item("") = True
                .Item("") = True
            End With
        strbody = "Testing"
        With iMsg
            Set .Configuration = iConf
            .To = ""
            .CC = ""
            .BCC = ""
            .From = ""
            .Subject = "Important message"
            .TextBody = strbody
        End With

        Set iMsg = Nothing
        Set iConf = Nothing
        Set Flds = Nothing

    Tuesday, March 24, 2020 5:47 PM

All replies

  • Hi,

    Thanks for visiting our forum, here we mainly focus on general issues about Outlook desktop client but your question is more related to Outlook for developers. So I'll move your thread to the dedicated forum for Outlook for developers.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thanks for your understanding and hope your question will be resolved soon.


    Aidan Wang

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact

    Wednesday, March 25, 2020 2:48 AM
  • SMTP server is, you connection must use TLS on port 587.

    Try to create a test POP3/SMTP account in Outlook to test the connection and its parameters. You might want to specify a dummy POP3 server to avoid downloading messages from your Exchange mailbox.

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, March 25, 2020 3:01 AM

  • Oskar Shon, Office System MVP -
    if Helpful; Answer when a problem solved

    Thursday, April 2, 2020 11:55 AM