diff --git a/Classes/Domain/Model/Mail.php b/Classes/Domain/Model/Mail.php index c7a09fc..f8792bf 100644 --- a/Classes/Domain/Model/Mail.php +++ b/Classes/Domain/Model/Mail.php @@ -43,8 +43,8 @@ public function __construct(array $mailData) $this->mailData = $mailData; $this->body = Arrays::getValueByPath($this->mailData, 'html'); - $this->recipients = Arrays::getValueByPath($this->mailData, 'headers.To'); - $this->subject = Arrays::getValueByPath($this->mailData, 'headers.Subject'); + $this->recipients = Arrays::getValueByPath($this->mailData, 'headers.to'); + $this->subject = Arrays::getValueByPath($this->mailData, 'headers.subject'); } diff --git a/Classes/Module/MailDev.php b/Classes/Module/MailDev.php index cbbd4df..941021d 100644 --- a/Classes/Module/MailDev.php +++ b/Classes/Module/MailDev.php @@ -100,10 +100,18 @@ public function seeTextInMail(string $text): void public function checkRecipientAddress(string $address): void { $recipients = $this->currentMail->getRecipients(); - foreach ($recipients as $recipient) { - if ($recipient === $address) { + if (is_string($recipients)) { + if ($recipients === $address) { return; } + } elseif (is_array($recipients)) { + foreach ($recipients as $recipient) { + if ($recipient === $address) { + return; + } + } + } else { + throw new \Exception(sprintf('Could not parse mail recipient: %s', print_r($address, true))); } throw new \Exception(sprintf('Did not find the recipient "%s" in the mail', $address)); }