是否可以仅通过客户端发送电子邮件? [英] Is it possible to send emails only with the client-side?
问题描述
我需要在使用Vue.js的前端应用程序中发送电子邮件,我想知道是否可以仅使用Javascript发送邮件。还是为此需要服务器端语言?谢谢!
I need to send emails in a front-end application that I'm using Vue.js, I would like to know if it's possible to send mail only with Javascript .. or do I need a server-side language for this? Thank you!
推荐答案
可能,但不实际。您可以使用smtpjs.com。
设置所有信息后,将它们添加到html中:
It is possible but not practical. You can use smtpjs.com. After you setup all the information, add these to your html:
HTML-> Head:
HTML -> Head:
<script src="https://smtpjs.com/v2/smtp.js"></script>
JS
Email.send("from@you.com",
"to@them.com",
"This is a subject",
"this is the body",
"smtp.yourisp.com",
"username",
"password");
如果您不想通过http发送凭据,也可以通过以下方式对其进行加密:
If you don't want to send your credentials over http, there's also a way to encrypt it as well.
您可以加密SMTP凭据,并将其锁定到单个域,然后传递安全令牌代替凭据,例如:
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("from@you.com",
"to@them.com",
"This is a subject",
"this is the body",
{token: "63cb3a19-2684-44fa-b76f-debf422d8b00"});
这篇关于是否可以仅通过客户端发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!