[英]Nodemailer works on my localhost but not on my remote server
I have this problem with nodemailer, which works fine on my localhost, but when I pull it on my remote server it doesn't works, giving me CONNTIMEOUT error.我的 nodemailer 有这个问题,它在我的本地主机上工作正常,但是当我将它拉到我的远程服务器上时它不起作用,给我 CONNTIMEOUT 错误。 Why does this happens?
为什么会这样? Pratically, nodemailer doesn't create the transporter for my message which I define in successive part of my code
实际上,nodemailer 不会为我在代码的连续部分中定义的消息创建传输器
const nodemailer = require('nodemailer');
const smtpPool = require('nodemailer-smtp-pool')
let transporter = nodemailer.createTransport(smtpPool({
service: "Gmail",
port: 587,
auth: {
user: 'myuser@gmail.com',
pass: 'mypass'
},
connectionTimeout: 10000,
socketTimeout: 10000
}));
transporter.verify(function(error,success) {
if(error) {
res.send(error);
} else {
res.send("Server is ready to take our messages");
}
})
Try doing-尝试做-
Check for all this and it should work.检查所有这些,它应该可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.