Sending email to multiple recipients via nodemailer

后端 未结 8 1820
青春惊慌失措
青春惊慌失措 2020-12-25 11:19

I am trying to send email to multiple recipients. For this I have created an array of recipients, but with my code I am only able to send mail to last email ID of the array

8条回答
  •  长情又很酷
    2020-12-25 11:34

    nodemailer (v2.4.2) docs say:

    to - Comma separated list or an array of recipients e-mail addresses that will appear on the To: field

    so you can just do:

    var maillist = [
      '****.sharma3@****.com',
      '****.bussa@****.com',
      '****.gawri@****.com',
    ];
    
    var msg = {
        from: "******", // sender address
        subject: "Hello ✔", // Subject line
        text: "Hello This is an auto generated Email for testing  from node please ignore it  ✔", // plaintext body
        cc: "*******",
        to: maillist
    }
    

提交回复
热议问题