I try to send email with EmailJS module for Express but it works only in local, it doesn't work in remote (AppFog)... I don't understand the problem...
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"
});
}
AppFog blocks SMTP outgoing requests to prevent spam.
You'll need to use a service such as Sendgrid, Amazon SES, Postmark, etc...