Auto detect phpmailer version removing need to configure
This commit is contained in:
parent
74c02675ab
commit
88a8433f6b
@ -16,8 +16,12 @@ if (file_exists('../common/mods/style.css')) {
|
|||||||
include "config.inc.php";
|
include "config.inc.php";
|
||||||
include($config_dir.'/phpmailer.inc.php');
|
include($config_dir.'/phpmailer.inc.php');
|
||||||
|
|
||||||
# The following line is required for phpmailer 6.0 or above
|
// Setup mailer
|
||||||
#use PHPMailer\PHPMailer\PHPMailer;
|
if(class_exists('PHPMailer')) {
|
||||||
|
$mail = new PHPMailer();
|
||||||
|
} else {
|
||||||
|
$mail = new PHPMailer\PHPMailer\PHPMailer();
|
||||||
|
}
|
||||||
|
|
||||||
include "head.inc";
|
include "head.inc";
|
||||||
$CONFIG = include($config_file);
|
$CONFIG = include($config_file);
|
||||||
@ -142,8 +146,6 @@ if ($ok || ($command == "Create") )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($CONFIG['verify_email']) {
|
if($CONFIG['verify_email']) {
|
||||||
// Setup mailer
|
|
||||||
$mail = new PHPMailer();
|
|
||||||
|
|
||||||
$mail->SMTPOptions = array(
|
$mail->SMTPOptions = array(
|
||||||
'ssl' => array(
|
'ssl' => array(
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
# Server info and credentials for sending email
|
# Server info and credentials for sending email
|
||||||
# (sending mail requires PHPMailer package installed)
|
# (sending mail requires PHPMailer package installed)
|
||||||
# PHPMailer settings (comment out the versions that do not apply)
|
|
||||||
|
|
||||||
# PHPMailer 6.0 and above:
|
if(is_file('/usr/share/php/libphp-phpmailer/src/PHPMailer.php')) {
|
||||||
#$phpmailer['phpmailer'] = '/usr/share/php/libphp-phpmailer/src/PHPMailer.php';
|
$phpmailer['phpmailer'] = '/usr/share/php/libphp-phpmailer/src/PHPMailer.php';
|
||||||
#$phpmailer['smtp'] = '/usr/share/php/libphp-phpmailer/src/SMTP.php';
|
$phpmailer['smtp'] = '/usr/share/php/libphp-phpmailer/src/SMTP.php';
|
||||||
|
} elseif(is_file('/usr/share/php/libphp-phpmailer/class.phpmailer.php')) {
|
||||||
# PHPMailer pre 6.0
|
$phpmailer['phpmailer'] = '/usr/share/php/libphp-phpmailer/class.phpmailer.php';
|
||||||
#$phpmailer['phpmailer'] = '/usr/share/php/libphp-phpmailer/class.phpmailer.php';
|
$phpmailer['smtp'] = '/usr/share/php/libphp-phpmailer/class.smtp.php';
|
||||||
#$phpmailer['smtp'] = '/usr/share/php/libphp-phpmailer/class.smtp.php';
|
} elseif(is_file('/usr/local/share/phpmailer/class.phpmailer.php')) {
|
||||||
|
|
||||||
# FreeBSD 12
|
|
||||||
$phpmailer['phpmailer'] = '/usr/local/share/phpmailer/class.phpmailer.php';
|
$phpmailer['phpmailer'] = '/usr/local/share/phpmailer/class.phpmailer.php';
|
||||||
$phpmailer['smtp'] = '/usr/local/share/phpmailer/class.smtp.php';
|
$phpmailer['smtp'] = '/usr/local/share/phpmailer/class.smtp.php';
|
||||||
|
}
|
||||||
|
|
||||||
$mailer = array();
|
$mailer = array();
|
||||||
$mailer['host'] = "mail.example.com";
|
$mailer['host'] = "mail.example.com";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user