Fix: PHPMailer is included through composer now

This commit is contained in:
slawkens 2021-01-04 19:17:07 +01:00
parent d5880eac8c
commit af161b5143

View File

@ -8,6 +8,7 @@
* @link https://my-aac.org * @link https://my-aac.org
*/ */
use PHPMailer\PHPMailer\PHPMailer;
use Twig\Loader\ArrayLoader as Twig_ArrayLoader; use Twig\Loader\ArrayLoader as Twig_ArrayLoader;
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
@ -818,13 +819,16 @@ function getWorldName($id)
*/ */
function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true) function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
{ {
/** @var PHPMailer $mailer */
global $mailer, $config; global $mailer, $config;
if (!config('mail_enabled')) {
log_append('mailer-error.log', '_mail() function has been used, but config.mail_enabled is disabled.');
}
if(!$mailer) if(!$mailer)
{ {
require SYSTEM . 'libs/phpmailer/PHPMailerAutoload.php';
$mailer = new PHPMailer(); $mailer = new PHPMailer();
$mailer->setLanguage('en', LIBS . 'phpmailer/language/'); //$mailer->setLanguage('en', LIBS . 'phpmailer/language/');
} }
else { else {
$mailer->clearAllRecipients(); $mailer->clearAllRecipients();