I'm making an SMTP-based mail sender. The code that I entered is -
<script>
function sendEmail(){
Email.send({
Host : "smtp.gmail.com",
Username : 'davnit7607@davnitjsr.org',
Password : "*************",
To : 'davnit7607@davnitjsr.org',
From : document.getElementById("email").value,
Subject : "Contact",
Body : "And this is the body"
}).then(
message => alert(message)
);
}
</script>
</body>
</html>
It's not working giving an error -
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
And-
Mailbox name not allowed. The server response was: Envelope FROM 'hi@gmail.com' email address not allowed.
Code