2015-09-21 40 views
0

在节点js中,我使用节点邮件发送邮件。如何识别邮件标识的服务名称

变种转运= nodemailer.createTransport({ 服务:的Gmail', AUTH:{ 用户: '[email protected]', 通: '*******' } });

这种情况下工作正常。

现在我打算使用“[email protected]”作为邮件标识进行身份验证。

变种转运= nodemailer.createTransport({ 服务: 'myhealthcircles', AUTH:{ 用户: '[email protected]', 通: '*******' } });

现在邮件没有发送。服务名称是否正确?或者我必须给别的东西。如果是这样,如何查找服务名称

回答

1

您需要使用nodemailer-SMTP-池模块,并在选项提供您的电子邮件,服务器证书:

var mailer = require('nodemailer'); 
var smtpPool = require('nodemailer-smtp-pool'); 
var option = { 
    host: 'localhost', 
    port: 25, 
    auth: { 
     user: '[email protected]', 
     pass: 'yourpassword' 
    } 
} 

mailer.createTransport(smtpPool(option)); 

... 
// to send the email 
mailer.sendMail(...) 

就是它了。

0

在Nodemailer中默认配置Gmail服务。如果您想使用自己的服务,则需要提供特定的服务名称,如webmail.myhealthcircles.com(可能是其他内容)。基本上,它应该与您提供的名称相同,如果您要在Microsoft Outlook或任何其他邮件客户端中进行配置。

+0

我试过webmail.myhealthcircles.com,myhealthcircles,webmail。但没有人在工作。 – Shanthi

+0

请向您的smtp提供商查询正确的服务名称。 – Aneesh