title: How do I use smtp.gmail.com in Google Apps Script?
body: <p>Is it possible to use <code>smtp.gmail.com</code> from within Google Apps Script?</p>
  <p>I am getting this error:</p>
  <blockquote>
  <p>Exception: Address unavailable: <a href="http://smtp.gmail.com" rel="nofollow noreferrer">http://smtp.gmail.com</a></p>
  </blockquote>
  <p>Here's the code:</p>
  <pre><code>var user = 'user@gmail.com';
  var password = 'thisisapassword';
  
  var emailData = {
                'to': 'recipient@example.com',
                'subject': 'This works!',
                'content': '&lt;b&gt;Testing successful&lt;/b&gt;'
              };
              
              var url = &quot;smtp.gmail.com&quot;;
              var request = {method:'POST',
                            contentType: 'text/html', 
                            payload: emailData, 
                            headers:{&quot;Authorization&quot;:&quot;Basic &quot; + Utilities.base64Encode(user + &quot;:&quot; + password), 
                            muteHttpExceptions: true}};
              
              UrlFetchApp.fetch(url, request);
  </code></pre>