Skip to content
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

[5.2] Added reply_to field for SparkPost API request within SparkpostTransport #13410

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Illuminate/Mail/Transport/SparkPostTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null)
'content' => [
'html' => $message->getBody(),
'from' => $this->getFrom($message),
'reply_to' => $this->getReplyTo($message),
'subject' => $message->getSubject(),
],
],
Expand Down Expand Up @@ -106,6 +107,19 @@ protected function getFrom(Swift_Mime_Message $message)
}, array_keys($message->getFrom()), $message->getFrom())[0];
}

/**
* 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()).'>';
}
}

/**
* Get the API key being used by the transport.
*
Expand Down