使用SMTP服务器从JavaScript发送电子邮件 [英] Sending Email from JavaScript with SMTP Server
问题描述
如果if语句变成else,我正在尝试自动在JavaScript中发送电子邮件.我有一个SMTP服务器,但是我真的不知道如何实现它.已经尝试了我发现的所有内容.我不想使用node.js,ajax或其他东西.
I'm trying to send an Email within my JavaScript automatically if an if statement turns into an else. I have an SMTP-Server, but I really dont know how to implement that. Already tried everything I found. I dont want to use node.js, ajax or something else.
推荐答案
您可以使用此工具:
它允许您在调用SMTP凭据时对其进行加密,以免将其暴露给客户端.
It allows you to encrypt your SMTP credentials when you call it so you don't expose them to the client side.
包括此脚本:
<script src="https://smtpjs.com/v2/smtp.js"></script>
然后您可以像这样调用服务:
And then you can call the service like this:
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 expose your credentials you can generate a secure token using the website I linked above.
Email.send("from@you.com",
"to@them.com",
"This is a subject",
"this is the body",
{token: "63cb3a19-2684-44fa-b76f-debf422d8b00"}
);
并这样称呼它.
这篇关于使用SMTP服务器从JavaScript发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!