title: Any alternative to CDO.message for sending emails through gmail using VBA
body: <p>when CDO.message (SMTP server) VBA code is run it checks if that gmail ID (from which we are sending email) is linked with the current system or not. If it is run on a new system where we never logged in with that gmail id then it gives sever failing error and email is not sent. So I want ask some other way with code (may be gmail api) which does not check for system's link with gmail ID.
  BELOW IS THE CODE THAT I AM USING</p>
  <pre><code> Dim iMsg As Object
  Dim iConf As Object
  Dim strbody As String
  Dim Flds As Variant
  Dim email As String
  Dim pass As String
  Dim CN As String
  Dim OS As String
  Set iMsg = CreateObject(&quot;CDO.Message&quot;)
  Set iConf = CreateObject(&quot;CDO.Configuration&quot;)
  
  iConf.Load -1
  Set Flds = iConf.Fields
  
  With Flds
  
      .Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpusessl&quot;) = 1
      .Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpauthenticate&quot;) = 1
      .Item(&quot;http://schemas.microsoft.com/cdo/configuration/sendusername&quot;) = FF
      .Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpaccountname&quot;) = &quot;abcd&quot;
      .Item(&quot;http://schemas.microsoft.com/cdo/configuration/sendpassword&quot;) = DD
      .Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;) = &quot;smtp.gmail.com&quot;
      .Item(&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 2
      .Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = 465
      .Update
      
  End With
  
   With iMsg
      Set .Configuration = iConf
      .To = FF
      .CC = &quot;&quot;
      .BCC = &quot;&quot;
      .From = &quot;&quot;&quot;from&quot;&quot; &lt;Reply@something.nl&gt;&quot;
      .Subject = UN &amp; &quot; C1 LOGGED IN&quot;
      .TextBody = &quot;COMPUTER NAME IS -&quot; &amp; CPN &amp; &quot;, USERNAME NAME IS -&quot; &amp; UN &amp; &quot;, COMPUTER ID IS -&quot; &amp; sAns
      .Send
      
  End With
  
  Set iMsg = Nothing
  Set iConf = Nothing
  Set Flds = Nothing
  </code></pre>
  <p>Application.ScreenUpdating = True
  Application.Calculation = xlCalculationAutomatic</p>