Skip to content

Commit d6c9803

Browse files
Add !empty check for reply to
1 parent e40de6e commit d6c9803

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/Mailer/MandrillMailer.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ public function send(MailMessage $message)
6060
'subject' => $message->getSubject(),
6161
'from_email' => $message->getFrom()->getEmail(),
6262
'from_name' => $message->getFrom()->getName(),
63-
'headers' => ['Reply-To' => $message->getReplyTo()->getEmail()],
6463
);
64+
65+
$replyTo=$message->getReplyTo();
66+
if(!empty($replyTo)) {
67+
$mandrillMessage['headers']=['Reply-To' => $replyTo->getEmail()];
68+
}
6569

6670
// Recipients.
6771
$recipients = [
@@ -87,7 +91,9 @@ public function send(MailMessage $message)
8791
$mandrillMessage['to'] = $to;
8892

8993
// Attachments.
90-
if (0 < $message->getAttachmentsSize() && $message->getAttachmentsSize() < $this->attachmentsSizeLimit && $attachments = $message->getAttachments()) {
94+
if (0 < $message->getAttachmentsSize() && $message->getAttachmentsSize() < $this->attachmentsSizeLimit
95+
&& $attachments = $message->getAttachments()
96+
) {
9197
$attachmentsArray = [];
9298
foreach ($attachments as $attachment) {
9399
$attachmentsArray[] = [

0 commit comments

Comments
 (0)