[英]Is it possible to send emails only with the client-side?
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?我需要在我使用 Vue.js 的前端应用程序中发送电子邮件,我想知道是否可以仅使用 Javascript 发送邮件..或者我需要服务器端语言吗? Thank you!谢谢!
所有电子邮件都是通过某种服务器发送的,因此您需要在线使用 API 或托管可以发送和接收邮件的服务器( Gmail 的 API要求您托管服务器)。
It is possible but not practical.这是可能的,但不实用。 You can use smtpjs.com.您可以使用 smtpjs.com。 After you setup all the information, add these to your html:设置完所有信息后,将这些添加到您的 html:
HTML -> Head: HTML -> 头部:
<script src="https://smtpjs.com/v2/smtp.js"></script>
JS JS
Email.send("from@you.com",
"to@them.com",
"This is a subject",
"this is the body",
"smtp.yourisp.com",
"username",
"password");
If you don't want to send your credentials over http, there's also a way to encrypt it as well.如果您不想通过 http 发送您的凭据,还有一种方法可以对其进行加密。
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:您可以加密您的 SMTP 凭据,并将其锁定到单个域,并传递安全令牌而不是凭据,例如:
Email.send("from@you.com",
"to@them.com",
"This is a subject",
"this is the body",
{token: "63cb3a19-2684-44fa-b76f-debf422d8b00"});
不,您不能从 javascript 或 Html 客户端发送电子邮件,因为它生成的 OTP 页面必须经过验证,然后它必须是服务器或使用任何第三方 API,您可以通过它发送电子邮件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.