Bogardo / Mailgun

Mailgun package for Laravel
MIT License
295 stars 115 forks source link

Double quotes when passing custom data #123

Closed mcblum closed 6 years ago

mcblum commented 7 years ago

Hello! Thanks for writing this package. I'm seeing a weird behavior where when I do $message->data('send_id', $this->send->id); it's coming back from Mailgun as send_id": "\"345345345-34534534dfsdf-23423sdfsdf\"". Any idea why it's getting sent through with double quotes or how to fix that?

Bogardo commented 6 years ago

All values send with the data() method are being encoded to JSON as you can see here:

In the Mailgun Library: https://github.com/mailgun/mailgun-php/blob/master/src/Mailgun/Messages/MessageBuilder.php#L482

And in the API Documentation: https://documentation.mailgun.com/en/latest/user_manual.html#attaching-data-to-messages