Nodemailer send email without smtp transport

前端 未结 7 1389
孤街浪徒
孤街浪徒 2021-02-01 19:47

I am trying to send emails via nodemailer without SMTP transport. So i\'ve done that:

var mail = require(\"nodemailer\").mail;

mail({
    from: \"Fred Foo ✔ <         


        
相关标签:
7条回答
  • 2021-02-01 20:23

    Looks like the the current nodemailer does not have the option of sending mail without smtp any more. I would recommend take a look at the sendmail library which does NOT need any smtp/auth to send email. It gives you similar experience to using sendmail in linux.

    const sendmail = require('sendmail')();
    
    sendmail({
      from: 'test@finra.org',
      to: 'YourName@gmail.com',
      subject: 'Hello World',
      html: 'Hooray NodeJS!!!'
    }, function (err, reply) {
      console.log(err && err.stack)
      console.dir(reply)
    })
    

    You can also turn on the silent to make it less verbose: const sendmail = require('sendmail')({silent: true});. One thing to notice is the sender cannot be those domains that has DMARC policy like xxx@capitalone.com.

    0 讨论(0)
提交回复
热议问题