1

我尝试使用 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"
    });
}
4

1 回答 1

2

AppFog 阻止 SMTP 传出请求以防止垃圾邮件。

您需要使用 Sendgrid、Amazon SES、Postmark 等服务...

于 2013-02-15T23:54:03.997 回答