You can use this tool:
It allows you to encrypt your SMTP credentials when you call it so you don’t expose them to the client side.
Include this script:
<script src="https://smtpjs.com/v2/smtp.js"></script>
And then you can call the service like this:
Email.send("[email protected]",
"[email protected]",
"This is a subject",
"this is the body",
"smtp.yourisp.com",
"username",
"password"
);
If you don’t want to expose your credentials you can generate a secure token using the website I linked above.
Email.send("[email protected]",
"[email protected]",
"This is a subject",
"this is the body",
{token: "63cb3a19-2684-44fa-b76f-debf422d8b00"}
);
And call it like this.
23
solved Sending Email from JavaScript with SMTP Server [closed]