Skip to content

Commit

Permalink
Clean up after PHPMailer#1155
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Sep 14, 2017
1 parent a120d97 commit 1bc0d46
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/PHPMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1642,11 +1642,11 @@ protected function mailSend($header, $body)
if ($this->SingleTo and count($toArr) > 1) {
foreach ($toArr as $toAddr) {
$result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
$this->doCallback($result, [$toAddr], $this->cc, $this->bcc, $this->Subject, $body, $this->From,[]);
$this->doCallback($result, [$toAddr], $this->cc, $this->bcc, $this->Subject, $body, $this->From, []);
}
} else {
$result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
$this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From,[]);
$this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From, []);
}
if (isset($old_from)) {
ini_set('sendmail_from', $old_from);
Expand Down Expand Up @@ -1720,6 +1720,7 @@ protected function smtpSend($header, $body)
throw new Exception($this->ErrorInfo, self::STOP_CRITICAL);
}

$callbacks = [];
// Attempt to send to all recipients
foreach ([$this->to, $this->cc, $this->bcc] as $togroup) {
foreach ($togroup as $to) {
Expand Down Expand Up @@ -1749,10 +1750,17 @@ protected function smtpSend($header, $body)
$this->smtp->close();
}

foreach ($callbacks as $cb)
{
$this->doCallback($cb['issent'],array($cb['to']),array(),array(),$this->Subject,$body,$this->From,
["smtp_transaction_id"=>$smtp_transaction_id]);
foreach ($callbacks as $cb) {
$this->doCallback(
$cb['issent'],
[$cb['to']],
[],
[],
$this->Subject,
$body,
$this->From,
['smtp_transaction_id' => $smtp_transaction_id]
);
}

//Create error message for any bad addresses
Expand Down

0 comments on commit 1bc0d46

Please sign in to comment.