如何识别邮件ID的服务名称
How to identify the service name of a mail id
在 node js 中,我使用 node mailer 发送邮件。
var transporter = nodemailer.createTransport({
service : 'gmail',
auth : {
user : 'xyz@gmail.com',
pass : '*******'
}
});
这个场景运行良好。
现在我将使用 "invite@myhealthcircles.com" 作为邮件 ID 进行身份验证。
var transporter = nodemailer.createTransport({
service : 'myhealthcircles',
auth : {
user : 'invite@myhealthcircles.com',
pass : '*******'
}
});
现在无法发送邮件。服务名称是否正确?或者我必须给别的东西。如果是这样,如何找到服务名称
Gmail 服务默认配置在 Nodemailer 中。如果您想使用自己的服务,则需要提供特定的服务名称,例如 webmail.myhealthcircles.com(也可以是其他名称)。基本上,如果您要在 Microsoft Outlook 或任何其他邮件客户端中配置它,它应该与您提供的名称相同。
您需要使用 nodemailer-smtp-pool 模块,并在选项中提供您的电子邮件服务器凭据:
var mailer = require('nodemailer');
var smtpPool = require('nodemailer-smtp-pool');
var option = {
host: 'localhost',
port: 25,
auth: {
user: 'your@email.com',
pass: 'yourpassword'
}
}
mailer.createTransport(smtpPool(option));
...
// to send the email
mailer.sendMail(...)
就是这样。
在 node js 中,我使用 node mailer 发送邮件。
var transporter = nodemailer.createTransport({ service : 'gmail', auth : { user : 'xyz@gmail.com', pass : '*******' } });
这个场景运行良好。
现在我将使用 "invite@myhealthcircles.com" 作为邮件 ID 进行身份验证。
var transporter = nodemailer.createTransport({ service : 'myhealthcircles', auth : { user : 'invite@myhealthcircles.com', pass : '*******' } });
现在无法发送邮件。服务名称是否正确?或者我必须给别的东西。如果是这样,如何找到服务名称
Gmail 服务默认配置在 Nodemailer 中。如果您想使用自己的服务,则需要提供特定的服务名称,例如 webmail.myhealthcircles.com(也可以是其他名称)。基本上,如果您要在 Microsoft Outlook 或任何其他邮件客户端中配置它,它应该与您提供的名称相同。
您需要使用 nodemailer-smtp-pool 模块,并在选项中提供您的电子邮件服务器凭据:
var mailer = require('nodemailer');
var smtpPool = require('nodemailer-smtp-pool');
var option = {
host: 'localhost',
port: 25,
auth: {
user: 'your@email.com',
pass: 'yourpassword'
}
}
mailer.createTransport(smtpPool(option));
...
// to send the email
mailer.sendMail(...)
就是这样。