app.get('/email', function(req,res){
var emailjs = require('emailjs');
var email_server = emailjs.server.connect({
host: 'smtp.gmail.com',
ssl: true,
tls: true,
port: "465",
user:'kateholloway@gmail.com',
password:'mypassword',
});
var h={
text: 'hey how you doing',
from: 'Kate Holloway <kateholloway@gmail.com>',
to: 'someonesemail@gmail.com',
subject: 'where is your phone'
};
var message = emailjs.message.create(h);
email_server.send(message, function(err,message){
console.log(err);
console.log(message);
res.send('ok');
});
});
これはそれを行うための正しい設定ですか?
私が得るエラーメッセージは次のとおりです。
{ [Error: connection has ended] code: 9, smtp: undefined }
注: このコードは、自分のドメイン/サーバーで動作します。ただし、Gmail では機能しません。したがって、Gmail smtp の設定が間違っていると思います。