title: Send CDO email using Outlook through excel VBA code
body: <p>I have code for emailing using CDO from internet - but I keep getting the message " The transport failed to connect to the server"</p>
  
  <p>I have tried various setting changes for server exchange but no luck.</p>
  
  <pre><code>`````
  strSubject = "Results from Excel Spreadsheet"
  strFrom = "jceast7@hotmail.com"   '"rdube02@gmail.com"
  strTo = "jceast7@hotmail.com"     '"rdube02@gmail.com"
  strCc = ""
  strBcc = ""
  strBody = "The total results for this quarter are: "   '&amp; Str
  
  'STEP 3
  'The next section of code is where you will configure CDO to use any
   external SMTP server to send the email.
  
  
  Set CDO_Mail = CreateObject("CDO.Message")
  On Error GoTo Error_Handling
  
  Set CDO_Config = CreateObject("CDO.Configuration")
  CDO_Config.Load -1
  
  Set SMTP_Config = CDO_Config.Fields
  
  With SMTP_Config
  .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")
  = "Microsoft Exchange"  '"smtp.hotmail.com"   '"smtp.gmail.com"
  .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")
  = 1
  .Item("http://schemas.microsoft.com/cdo/configuration/sendusername")
  = "jceast7@hotmail.com"     '"email@website.com"
  .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")
  = "123456"
  .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") 
  = 25
  .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
  .Update
  End With
  
  With CDO_Mail
  Set .Configuration = CDO_Config
  End With
  ``````
  </code></pre>