title: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. In html
body: <p>I'm making an SMTP-based mail sender. The code that I entered is -</p>
  <pre class="lang-html prettyprint-override"><code>    &lt;script&gt;
      function sendEmail(){
          Email.send({
              Host : &quot;smtp.gmail.com&quot;,
              Username : 'davnit7607@davnitjsr.org',
              Password : &quot;*************&quot;,
              To : 'davnit7607@davnitjsr.org',
              From : document.getElementById(&quot;email&quot;).value,
              Subject : &quot;Contact&quot;,
          Body : &quot;And this is the body&quot;
  }).then(
    message =&gt; alert(message)
  );
      }
          
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>It's not working giving an error -
  <code>The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at - Fix: Try a different SMTP server: https://elasticemail.com/account#/create-account?r=20b444a2-b3af-4eb8-bae7-911f6097521c</code></p>
  <p>And-
  <code>Mailbox name not allowed. The server response was: Envelope FROM 'hi@gmail.com' email address not allowed.</code>
  <a href="https://i.stack.imgur.com/yrbNy.png" rel="nofollow noreferrer">Code</a></p>