Upgrade to 3.4.1
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Kirby\Email;
|
||||
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use PHPMailer\PHPMailer\PHPMailer as Mailer;
|
||||
|
||||
/**
|
||||
@@ -67,6 +68,17 @@ class PHPMailer extends Email
|
||||
$mailer->Port = $this->transport()['port'] ?? null;
|
||||
}
|
||||
|
||||
// accessible phpMailer instance
|
||||
$beforeSend = $this->beforeSend();
|
||||
|
||||
if (empty($beforeSend) === false && is_a($beforeSend, 'Closure') === true) {
|
||||
$mailer = $beforeSend->call($this, $mailer) ?? $mailer;
|
||||
|
||||
if (is_a($mailer, 'PHPMailer\PHPMailer\PHPMailer') === false) {
|
||||
throw new InvalidArgumentException('"beforeSend" option return should be instance of PHPMailer\PHPMailer\PHPMailer class');
|
||||
}
|
||||
}
|
||||
|
||||
if ($debug === true) {
|
||||
return $this->isSent = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user