SmtpJs API 不工作!有没有办法使用带有 JavaScript 或 JQuery 的 SMTP 服务器发送电子邮件 [英] SmtpJs API not working! is there any way to send emails using SMTP server with JavaScript or JQuery

查看:25
本文介绍了SmtpJs API 不工作!有没有办法使用带有 JavaScript 或 JQuery 的 SMTP 服务器发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 JS 、 Jquery 和 NoSQL DB 的应用程序.我没有任何后端技术,例如 Node 或 C# .我的 Web UI 直接与数据库交互.

I have an application with JS , Jquery and NoSQL DB . I don't have any backend technology such as Node or C# . my web UI directly interacts with DataBase.

现在向数据库提交数据后,我想向用户发送电子邮件通知.我在互联网上搜索,有一些文章说我们在处理 SMTP 服务器时无法使用客户端代码发送电子邮件.

Now after submitting data to DB, I want to send email notifications to users. I searched on internet and there are some articles which say we can't send emails with client side code as we deal with SMTP server.

休闲来自 smtpjs.com

the fallowing is from smtpjs.com

<script src="js/smtp.js"></script>
<script>
     Email.send("vkxyz@abc.com",
                "vk@nyu.edu",
                "This is a subject",
                "this is the body",
                "smtp.qwe.io",
                "vkxyz@abc.com",
                "abcq4#");
</script>

上面的代码段不起作用.尝试了互联网上可用的其他一些片段,但没有任何效果.

the above snippet is not working. tried some other snippets available on internet but nothing works.

顺便说一下,我的 SMTP 服务器有防火墙,并且只接受来自本地网络.上面的代码我没有得到任何连接错误日志.

By the way my SMTP server has firewall and accepts from local network only. I din't get any connection error log with above code.

那么是否可以使用 JavaScript Jquery 发送电子邮件,如果可以,请提出最佳做法

so is it possible to send email with JavaScript Jquery , if so please kindly suggest the best practice

提前致谢

推荐答案

无法使用带有 JS 或 Jquery 的 SMTP 服务器发送电子邮件.

It is not possible to send emails using SMTP servers with JS or Jquery.

没有办法直接从我们的浏览器访问 SMTP 服务器.

There is no way to hit SMTP server directly from our browsers.

EmailJS 或 SMTPJs 为我们提供 API,但最终我们使用他们的服务器来访问 SMTP.实际上,我们正在向他们的服务器发送数据,该服务器进一步向 SMTP 服务器发送数据.

EmailJS or SMTPJs gives us API but eventually we are using their servers to hit the SMTP. actually we are sending data to their server which further sends data to SMTP servers.

所以我们必须需要一个服务器来发送到 SMTP.我们可以使用 NodeJs、C#、Python 或 Java 来做到这一点.

So we must need a server to send to SMTP. and we can use NodeJs,C#,Python or Java to do this.

就我而言,我什至尝试过 EmailJs ,但我的 SMTP 服务器阻止了 EmailJs 服务器 IP 地址.

In my case I even tried EmailJs , but my SMTP server blocks EmailJs server IP address.

如果您使用的是企业级 SMTP 服务器,则绝对不能通过浏览器 JS &查询.您必须在后端使用服务器并在 NodeJS 等中编写一些代码...

If you are using enterpise SMTP server , in no way you can email through browser JS & Jquery. you must use a server in backend and write some code in NodeJS etc...

谢谢 &如果我错了,请纠正我

Thanks & correct me If I am wrong

这篇关于SmtpJs API 不工作!有没有办法使用带有 JavaScript 或 JQuery 的 SMTP 服务器发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆