我尝试发送带有EmailJS模块的电子邮件用于Express,但它仅适用于本地,它不能在远程(AppFog)工作......我不明白这个问题......
var email = require("emailjs");
var server = email.server.connect({
user: "******",
password: "******",
host: "smtp.gmail.com",
ssl: true
});
var send = function(message, from, subject) {
server.send({
text: message,
from: from,
to: "******** <*********>",
subject: subject
});
}
exports.index = function(req, res) {
res.render('contact', {
emailSuccess: false,
title: "my title"
});
}
exports.send = function(req, res) {
send(req.body.message, req.body.from, req.body.subject);
res.render('contact', {
emailSuccess: true,
title: "my title"
});
}
答案 0 :(得分:2)
AppFog阻止SMTP传出请求以防止垃圾邮件。
您需要使用Sendgrid,Amazon SES,Postmark等服务......