<script src="https://smtpjs.com/v3/smtp.js"> </script>
Email.send({ Host : "smtp.mailendo.com", Username : "username", Password : "password", To : 'them@website.com', From : "you@isp.com", Subject : "This is the subject", Body : "And this is the body" }).then( message => alert(message) );
We've thought of that, so instead you can encrypt your SMTP credentials, and lock it to a single domain, and pass a secure token instead of the credentials instead, for example:
Email.send({ SecureToken : "C973D7AD-F097-4B95-91F4-40ABC5567812", To : 'them@website.com', From : "you@isp.com", Subject : "This is the subject", Body : "And this is the body" }).then( message => alert(message) );
Note: By default, the SMTP connection is secure (STARTTLS) and over port 25. If you need to use an SMTP server that does not accepts secure connections, or in on a non-standard port, like 587, then use the button above "Encrypt your SMTP Credentials" to store advanced configuration.
We have a zero tolerance for spam. If you get one spam report, we close your account. Sorry about that, but this is a free service, and we're not taking any heat for you.
If your code needs to know when the email is sent before continuing, then you should use the promise returned from the send function. This will pass a message of "OK" for success, and an error message as failure.
This is a free script, no usage restrictions. You can include it license free, in any project, either commercial or non commercial.
Attachments:
Want to send with attachments?, use the Attachments property:
Email.send({ SecureToken : "C973D7AD-F097-4B95-91F4-40ABC5567812", To : 'them@website.com', From : "you@isp.com", Subject : "This is the subject", Body : "And this is the body", Attachments : [ { name : "smtpjs.png", path : "https://networkprogramming.files.wordpress.com/2017/11/smtpjs.png" }] }).then( message => alert(message) );
Dev Tip: If you want to send an attachment in base64 format, instead of passing "path" as a property, send a "data" property in dataUri format. in dataUri format. (Example coming soon!)
Sending multiple emails: