mailersend / mailersend-nodejs

The official MailerSend Node.js SDK
https://developers.mailersend.com
MIT License
136 stars 17 forks source link

Change setSettings type from array to object #90

Open PeterOcansey opened 4 months ago

PeterOcansey commented 4 months ago

SetSettings is declared to receive an array of EmailSettings.

image.png

Passing an array or object does not work

const params = new EmailParams()
.setFrom(new Sender('no-reply@youremail', 'YourEmail'))
.setTo([new Recipient(to)])
.setSubject(subject)
.setHtml(html)
.setSettings([{ track_clicks: false, track_opens: false, track_content: false }]);
await this.mailer.email.send(params);

Error

{
"message": "The settings.0 field must be true or false.",
"errors": {
"settings.0": [
"The settings.0 field must be true or false."
]
}

Settings should be an object, let's change the settings params to an Object