title: send gmail using powershell
body: <p>I'm developing a simply monitoring too for my home and I need it to send me an email.  However, no matter what I try, it is not connecting to my gmail account to send the notification - or even a simple test message.  I have a script that is working for a utility I wrote for work, but that is using the corporate SMTP relay.  I'm not going to mix work and personal resources.</p>
  
  <p>I have spent the past 4-5 weeks digging through this and trying several other development languages.  All have come up with similar problems.</p>
  
  <p>I have attempted the following:</p>
  
  <ul>
  <li>Turned on less secure apps</li>
  <li>Tried a variety of ports, 25, 465, 587</li>
  <li>Turned on and off SSL</li>
  <li>Tried various forms of my username (email address)</li>
  <li>Turned on 2-factor authentication and created an app password for this utility</li>
  <li>Attempted to turn on TLS - as one error indicated I needed a starttls command.</li>
  </ul>
  
  <p>With Powershell, I seem to get two common errors.  The first one is dependent on the parameters I'm sending to the Send argument - regardless, it fails. </p>
  
  <p>[Screenshot of error - ][1]</p>
  
  <p>I have been on multiple forums and sites.  All of the suggested code appears to be all variants of the same structure, as is the working one for my office - just using our own mail system.</p>