Upgrade to 3.4.1

This commit is contained in:
Bastian Allgeier
2020-08-04 15:56:15 +02:00
parent f2f3bb96c0
commit 68078dd107
33 changed files with 328 additions and 318 deletions

View File

@@ -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;
}