Skip to content

Commit

Permalink
Handle missing 'to' email header
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Jul 16, 2020
1 parent b38ee57 commit e923290
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions inc/mailcollector.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1369,14 +1369,16 @@ function getHeaders(\Laminas\Mail\Storage\Message $message) {
$mail_details = [];

// Construct to and cc arrays
$h_tos = $message->getHeader('to');
$tos = [];
foreach ($h_tos->getAddressList() as $address) {
$mailto = Toolbox::strtolower($address->getEmail());
if ($mailto === $this->fields['name']) {
$to = $mailto;
if (isset($message->to)) {
$h_tos = $message->getHeader('to');
foreach ($h_tos->getAddressList() as $address) {
$mailto = Toolbox::strtolower($address->getEmail());
if ($mailto === $this->fields['name']) {
$to = $mailto;
}
$tos[] = $mailto;
}
$tos[] = $mailto;
}

$ccs = [];
Expand Down

0 comments on commit e923290

Please sign in to comment.