Skip to content

SparkPost SDK Cannot Escape Double Quotes In Sender Name #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pavattt opened this issue May 27, 2025 · 0 comments
Open

SparkPost SDK Cannot Escape Double Quotes In Sender Name #216

pavattt opened this issue May 27, 2025 · 0 comments

Comments

@pavattt
Copy link

pavattt commented May 27, 2025

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,
                    ],
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant