mailersend / mailersend-php

The official MailerSend PHP SDK
https://developers.mailersend.com
MIT License
64 stars 21 forks source link

Change setSettings type from array to object #128

Closed PeterOcansey closed 3 months ago

PeterOcansey commented 3 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