datasource.json:
"emailDs": {
"name": "emailDs",
"connector": "mail",
"transports": [{
"type": "smtp",
"host": "smtp.myapp.in",
"secure": true,
"secureConnection": true,
"port": 587,
"tls": {
"rejectUnauthorized": false
},
"auth": {
"user": "name@myapp.in",
"pass": "pwd"
}
}]
}

模型config.json
"Email": {
"dataSource": "emailDs"
}
mymodel.js(扩展默认的loopbacl&#39用户模型)
var options = {
type: 'email',
to: myUser.email,
from: 'name@myapp.in',
subject: 'Thanks for registering.',
template: path.resolve(__dirname, '../../server/views/verify.ejs'),
redirect: '/verified',
entrepreneur: entrepreneur
};
myUser.verify(options, function(err, response) {
if (err) {
next(err);
return;
}
当我创建新用户时,此 afterRemote '创建'代码正在运行,但在发送邮件时出现以下错误:
{
"error": {
"name": "Error",
"status": 500,
"message": "getaddrinfo EAI_AGAIN",
"code": "EAI_AGAIN",
"errno": "EAI_AGAIN",
"syscall": "getaddrinfo",
"hostname": "smtp.myapp.in",
"stack": "Error: getaddrinfo EAI_AGAIN\n at Object.exports._errnoException (util.js:746:11)\n at errnoException (dns.js:49:15)\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26)"
}
}
我在Bigrock中创建了一个新域,并使用他们提供的免费电子邮件服务。请在这里建议我做错了什么。