Skip to content

Commit

Permalink
[5.2] Added reply_to field for SparkPost API request within Sparkpost…
Browse files Browse the repository at this point in the history
…Transport (#13410)

* Added reply_to field for SparkPost API request

Signed-off-by: Byron Smith <byronsmith@30db80bfe262>

* Added reply_to field for SparkPost API request

Signed-off-by: Byron Smith <[email protected]>
  • Loading branch information
byronsmith authored and taylorotwell committed May 4, 2016
1 parent d9cc1bd commit 00ad6ed
Showing 1 changed file with 14 additions and 0 deletions.
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

0 comments on commit 00ad6ed

Please sign in to comment.