title: CDO mail issue "The transport failed to connect to the server"
body: <p>I am trying to set up a userform in an Excel file that sends an email to report any bugs/issues the user finds with the spreadsheet.</p>
  
  <pre><code>Dim iMsg As Object
  Dim iConf As Object
  Dim Flds As Variant
  
  Set iMsg = CreateObject("CDO.Message")
  Set iConf = CreateObject("CDO.Configuration")
  
  iConf.Load -1
  Set Flds = iConf.Fields
  
  With Flds
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "bugreporter@gmail.com"
      .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" 'smtp mail server
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'stmp server
      .Update
  End With
  
  With iMsg
  
      Set .Configuration = iConf
      .To = "example@domain.com"
      .From = "bugreporter@gmail.com"
      .Subject = "Hello"
      .TextBody = "Hi Dude"
      .Send
  End With
  
  Set iMsg = Nothing
  Set iConf = Nothing
  </code></pre>
  
  <p>I get an error "The transport failed to connect to the server".  I don't know much about ports/port-forwarding, but I have tried ports 25, 465, and 587 and none of them work.  I am running this from a work network, but I assume at least one port must be open as we have Outlook running on everyone's computers.</p>
  
  <p>I have enabled IMTP on the gmail account, as well as allowing less secure apps.</p>