2015-06-18 29 views
1

我可以在使用sendmail的Linux计算机上使用任何没有密码的电子邮件地址发送电子邮件。有没有这样的选择,以编程方式使用node.js在Windows中?使用nodejs发送未经身份验证的邮件

+0

你可能想看看nodemailer模块https://github.com/andris9/Nodemailer – Ben

+1

@Ben nodemailer要求进行身份验证 – NagaLakshmi

+0

@NagaLakshmi那么你很可能无法正常使用。看看['nodemailer-sendmail-transport'](https://github.com/andris9/nodemailer-sendmail-transport)模块。 – robertklep

回答

1

使用NodeMailer。这会给你两个选择:

  1. 您可以从示例代码remove auth创建SMTP Transport消息时,如果你有local IIS SMTP turned on。显然,设置host: 'localhost'和其他设置以匹配您的SMTP。

  2. 或者,你可能能够利用sendmail-transport与某些第三方软件如Sendmail for Windows。 SMW模拟unix方法。不幸的是,SMW不再被维护。

+0

这个答案似乎在做一些假设,即Window以某种方式参与(IIS,Sendmail for Windows)。如果情况并非如此,你能否解决如何进行? – Michael

0

我会推荐看看sendmail库,它不需要任何smtp/auth来发送电子邮件。它给你类似的经验,在linux服务器中使用sendmail

const sendmail = require('sendmail')(); 

sendmail({ 
    from: '[email protected]', 
    to: '[email protected]', 
    subject: 'Hello World', 
    html: 'Mail of test sendmail ' 
}, function (err, reply) { 
    console.log(err && err.stack) 
    console.dir(reply) 
}) 
相关问题