From 5519cf060c3630a19461e5739a975e2e1262dfb6 Mon Sep 17 00:00:00 2001 From: Byron Smith Date: Tue, 3 May 2016 01:21:05 +0000 Subject: [PATCH 1/2] Added reply_to field for SparkPost API request Signed-off-by: Byron Smith --- .../Mail/Transport/SparkPostTransport.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Illuminate/Mail/Transport/SparkPostTransport.php b/src/Illuminate/Mail/Transport/SparkPostTransport.php index 98612f9885b5..96a16aa9f533 100644 --- a/src/Illuminate/Mail/Transport/SparkPostTransport.php +++ b/src/Illuminate/Mail/Transport/SparkPostTransport.php @@ -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(), ], ], @@ -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. * From 62d4fc74188e0ceeb8fcedabdfc850c2ab066dc8 Mon Sep 17 00:00:00 2001 From: Byron Smith Date: Tue, 3 May 2016 01:28:41 +0000 Subject: [PATCH 2/2] Added reply_to field for SparkPost API request Signed-off-by: Byron Smith --- src/Illuminate/Mail/Transport/SparkPostTransport.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Mail/Transport/SparkPostTransport.php b/src/Illuminate/Mail/Transport/SparkPostTransport.php index 96a16aa9f533..9fec38354418 100644 --- a/src/Illuminate/Mail/Transport/SparkPostTransport.php +++ b/src/Illuminate/Mail/Transport/SparkPostTransport.php @@ -54,7 +54,7 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) 'content' => [ 'html' => $message->getBody(), 'from' => $this->getFrom($message), - 'reply_to' => $this->getReplyTo($message), + 'reply_to' => $this->getReplyTo($message), 'subject' => $message->getSubject(), ], ], @@ -108,7 +108,7 @@ protected function getFrom(Swift_Mime_Message $message) } /** - * Get the 'reply_to' headers and format as required by sparkpost + * Get the 'reply_to' headers and format as required by SparkPost. * * @param Swift_Mime_Message $message * @return string