使用EmailJS可以直接从JavaScript发送电子邮件。
请查看下面的答案,我收到了很多有关恶意攻击的评论..因为该文件在浏览器中加载,所以恶意用户可以轻易地获取您的密钥配置。那么,如何避免呢?
var templateParams = {
to_name: 'xyz',
from_name: 'abc',
message_html: 'Please Find out the attached file'
};
emailjs.send('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID', templateParams)
.then(function(response) {
console.log('SUCCESS!', response.status, response.text);
}, function(error) {
console.log('FAILED...', error);
});