Skip to content

SparkPost SDK Cannot Escape Double Quotes In Sender Name #216

Open
@pavattt

Description

@pavattt

SparkPost SDK version: 2.3.0

Error: {"error":"{"errors":[{"message":"content.from and content.name must sum to an even number of nested quote(s)","code":"1902"}]}","code":422,"body":{"errors":[{"message":"content.from and content.name must sum to an even number of nested quote(s)","code":"1902"}]}

Example code:

If $name contains double quote, we get the above error. As a user of the library, I believe SparkPost should be able to handle the below scenario and escape the name correctly because otherwise I need to dive into SDK code to confirm that my escaping method is compliant with the SDK.

$name = 'Chef"s Kitchen';

$this->mailer->transmissions->post([
                'campaign_id' => $options['campaign_id'] ?? null,
                'options' => [
                    'transactional' => true,
                    'click_tracking' => false,
                    'perform_substitutions' => false,
                ],
                'return_path' => $this->getReturnPath($sender->address),
                'content' => [
                    'from' => [
                        'email' => $sender->address,
                        'name' => $name,
                    ],
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions