我尝试使用 Express 的 EmailJS 模块发送电子邮件,但它只能在本地工作,它不能在远程(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"
});
}