Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Add reply_to as part of the JSON request in SparkPostTransport #76

Closed
byronsmith opened this issue May 3, 2016 · 3 comments
Closed

Comments

@byronsmith
Copy link

Hi! Need to include a reply_to in the SparkPostTransport as part of the SparkPost API request.

    /**
     * {@inheritdoc}
     */
    public function send(Swift_Mime_Message $message, &$failedRecipients = null)
    {
        ...
        $options = [
            'headers' => [
                'Authorization' => $this->key,
            ],
            'json' => [
                'recipients' => $recipients,
                'content' => [
                    'html' => $message->getBody(),
                    'from' => $this->getFrom($message),
                    'reply_to' => $this->getReplyTo($message),
                    'subject' => $message->getSubject(),
                ],
            ],
        ];
        ...
     }

And new getReplyTo method.

    /**
     * Get the 'reply_to' headers and format as required by sparkpost
     *
     * @param  Swift_Mime_Message  $message
     * @return string
     */
    protected function getReplyTo(Swift_Mime_Message $message)
    {
        if (is_array($message->getReplyTo())) {
            return current($message->getReplyTo()).' <'.key($message->getReplyTo()).'>';
        }
    }

Is this something I can contribute myself or is posting it here recommended?

@byronsmith
Copy link
Author

I added a pull request for this regardless. Hopefully I've done everything ok!
laravel/framework#13410

@tillkruss
Copy link

tillkruss commented May 17, 2016

Can this be closed now, since laravel/framework#13410 got merged?

@byronsmith
Copy link
Author

Hi, yes, apologies. I will close it. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants