title: Issue while sending the mail using cdo configuration in vb script
body: <p>I have a requirement that I need to send mails from excel. We are using MS Excel for doing some functionalities and it will generate a report after the executing all the steps. </p>
  
  <p>The folder structure is below.</p>
  
  <p>A=>(report.html , A1,A2,A3)
   A{0} is a folder inside A (main folder) and has report.html in each folder.
      The main report , basically contains link to all other reports.  User can view the sub reports. </p>
  
  <p>Till this , it working fine. </p>
  
  <p>Next Requirement is to Zip the folder A, so that all other folders are available in that zip. That’s also working. </p>
  
  <p>Finally we need to send the zip file to a given mail ID. Here is the issue.</p>
  
  <p>I am attaching the vbs file, which I used to send the mail. But its behaving differently on different network.</p>
  
  <p>On office network                                          :               CDO.Message.1: The transport failed to connect to the server.</p>
  
  <p>On Client network (using Citrix)                :               CDO.Message.1: The transport failed to connect to the server.</p>
  
  <p>On Home Network                                         :               It’s worked and I got the mail.</p>
  
  <p>SMTP Settings
     Server –  smtp.office365.com
     Port – 587 (also tried with 25)
     SSL -  true (according to Office 365 they are using TSL)</p>
  
  <p>How to identify the issue ?</p>
  
  <p>Code below.</p>
  
  <pre><code>Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory. 
  Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network). 
  
  Const cdoAnonymous = 0 'Do not authenticate
  Const cdoBasic = 1 'basic (clear-text) authentication
  Const cdoNTLM = 2 'NTLM
  
  Set objMessage = CreateObject("CDO.Message") 
  objMessage.Subject = "Example CDO Message" 
  objMessage.From = "$MailID$" 
  objMessage.To = "$ToID$" 
  objMessage.TextBody = "This is some sample message text.." &amp; vbCRLF &amp; "It was sent using SMTP authentication."
  
  '==This section provides the configuration information for the remote SMTP server.
  
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
  
  'Name or IP of Remote SMTP Server
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "$SMTPServer$"
  
  'Type of authentication, NONE, Basic (Base64 encoded), NTLM
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
  
  'Your UserID on the SMTP server
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "$MailID$"
  
  'Your password on the SMTP server
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "$Password$"
  
  'Server port (typically 25)
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $PortNo$ 
  
  'Use SSL for the connection (False or True)
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
  
  'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10000
  
  'objMessage.Addattachment "D:\Vn\POC\attachfile.txt"
  
  objMessage.Configuration.Fields.Update
  
  '==End remote SMTP server configuration section==
  
  objMessage.Send
  </code></pre>