今天要在一个老web系统上实现批量发送邮件服务,没办法更改后台代码,只能写到前端了。
既然写到前端,安全性的问题就不要再说了,肯定不安全啊。
下面是Html代码:
<!DOCTYPE html>
<html>
<script src="https://smtpjs.com/v3/smtp.js">
</script>
<head>
<title>Title of the document</title>
</head>
<body>
The content of the document......
</body>
<script>
Email.send({
Host : "smtp.163.com",
Username : "username@163.com",
Password : "password",
To : 'mubiaoYouXiang@qq.com',
From : "sendEmail@163.com",
Subject : "测试案例",
Body : "收到请回复"
}).then(
message => alert(message)
);;
</script>
</html>
就是这么简单,只使用了smtp.js的cdn。
如果要用到附件,请看官方demo。
下面是官方的网址:
本文介绍了一种在老web系统中利用前端实现批量发送邮件的方法,通过调用smtp.js库,仅修改前端代码即可实现邮件服务,适用于无法更改后台代码的情况。
5037

被折叠的 条评论
为什么被折叠?



