Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I send email using javascript

Is it possible to send emails using just javascript?

like image 833
dotty Avatar asked Dec 15 '10 19:12

dotty


2 Answers

EDIT: [WARNING!] README:

It's a third party library that connects to an external server, take care with the information that you are sending.


Another solution on JS you can use a library named smtpjs

Add following library your html on header:

<script src="https://smtpjs.com/smtp.js"></script>

Use this without security:

Email.send("[email protected]",
"[email protected]",
"This is a subject",
"this is the body",
"smtp.yourisp.com",
"username",
"password");

Use this with security:

Email.send("[email protected]",
"[email protected]",
"This is a subject",
"this is the body",
{token: "63cb3a19-2684-44fa-b76f-debf422d8b00"});
like image 188
mfruizs Avatar answered Sep 20 '22 23:09

mfruizs


It's actually possible and not all that difficult to build an SMTP client in Javascript.

But that SMTP client will still need to talk to an SMTP server for getting its emails delivered. And SMTP servers open to everyone are very rare nowadays (because they quickly become Spam conduits and then blocked and/or closed).

However, if the person using the client can supply an SMTP server and user credentials for it (just like with any other general purpose email client), then yes, you can send emails using just javascript.

like image 30
Michael Borgwardt Avatar answered Sep 22 '22 23:09

Michael Borgwardt