Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Microsoft 365 email from excel vba

$
0
0

I have tried this code for sending CDO, but it fails to connect with server. I have checked the smpt and smpt port are correct.

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") _

                         = "smtp.office365.com"

            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587

            .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"

            .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"

           .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True

            .Update

        End With


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>