mailgun-js-boland icon indicating copy to clipboard operation
mailgun-js-boland copied to clipboard

Send to mailing list example?

Open oristian opened this issue 5 years ago • 1 comments

Is there a way to send to a mailing list passing in a template? do you just use message().send() with the mailing list as the address? Or is there other example code I haven't been able to find?

Thanks

oristian avatar Jan 23 '20 05:01 oristian

Hey,

I don't know what do you mean by mailing list passing in a template but if you just want to send message to mails that you have in mailing list it's simple ->

    const data = {
      from: '[email protected]',
      to: '[email protected]', <- here you put your mailing list name before @
      subject: 'Example message',
      html: '<p>Example message</p>'
    }

      await mg.messages().send(data, function(error, body) {
        return error
      })

Hope I helped 👍

SerekKiri avatar Feb 23 '20 21:02 SerekKiri