使用SMTP.JS发送邮件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u012605477/article/details/88399119

今天要在一个老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 : "[email protected]",
    Password : "password",
    To : '[email protected]',
    From : "[email protected]",
    Subject : "测试案例",
    Body : "收到请回复"

}).then(
  message => alert(message)
);;
</script>

</html>

就是这么简单,只使用了smtp.js的cdn。

如果要用到附件,请看官方demo。

下面是官方的网址:

https://www.smtpjs.com/

猜你喜欢

转载自blog.csdn.net/u012605477/article/details/88399119