NodeJS Sendgrid Issue in sending email to multiple recipients

前端 未结 5 1125
清酒与你
清酒与你 2020-12-21 03:31

I am having issue in sending mails to multiple recipients.

My script is

var SendGrid = require(\'sendgrid\').SendGrid;
var sendgrid = new SendGrid(\         


        
5条回答
  •  心在旅途
    2020-12-21 04:22

    For Sendgrid's v3 API, I found their "kitchen sink" example helpful. Here is a relevant bit from it:

    var helper = require('sendgrid').mail
    
    mail = new helper.Mail()
    email = new helper.Email("test@example.com", "Example User")
    mail.setFrom(email)
    
    mail.setSubject("Hello World from the SendGrid Node.js Library")
    
    personalization = new helper.Personalization()
    email = new helper.Email("test1@example.com", "Example User")
    personalization.addTo(email)
    email = new helper.Email("test2@example.com", "Example User")
    personalization.addTo(email)
    
    // ...
    
    mail.addPersonalization(personalization)
    

提交回复
热议问题