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_dir.'/phpmailer.inc.php');
|
||||
|
||||
# The following line is required for phpmailer 6.0 or above
|
||||
#use PHPMailer\PHPMailer\PHPMailer;
|
||||
// Setup mailer
|
||||
if(class_exists('PHPMailer')) {
|
||||
$mail = new PHPMailer();
|
||||
} else {
|
||||
$mail = new PHPMailer\PHPMailer\PHPMailer();
|
||||
}
|
||||
|
||||
include "head.inc";
|
||||
$CONFIG = include($config_file);
|
||||
@ -142,8 +146,6 @@ if ($ok || ($command == "Create") )
|
||||
}
|
||||
}
|
||||
if($CONFIG['verify_email']) {
|
||||
// Setup mailer
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$mail->SMTPOptions = array(
|
||||
'ssl' => array(
|
||||
|
@ -1,19 +1,17 @@
|
||||
<?php
|
||||
# Server info and credentials for sending email
|
||||
# (sending mail requires PHPMailer package installed)
|
||||
# PHPMailer settings (comment out the versions that do not apply)
|
||||
|
||||
# PHPMailer 6.0 and above:
|
||||
#$phpmailer['phpmailer'] = '/usr/share/php/libphp-phpmailer/src/PHPMailer.php';
|
||||
#$phpmailer['smtp'] = '/usr/share/php/libphp-phpmailer/src/SMTP.php';
|
||||
|
||||
# PHPMailer pre 6.0
|
||||
#$phpmailer['phpmailer'] = '/usr/share/php/libphp-phpmailer/class.phpmailer.php';
|
||||
#$phpmailer['smtp'] = '/usr/share/php/libphp-phpmailer/class.smtp.php';
|
||||
|
||||
# FreeBSD 12
|
||||
$phpmailer['phpmailer'] = '/usr/local/share/phpmailer/class.phpmailer.php';
|
||||
$phpmailer['smtp'] = '/usr/local/share/phpmailer/class.smtp.php';
|
||||
if(is_file('/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';
|
||||
} elseif(is_file('/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';
|
||||
} elseif(is_file('/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';
|
||||
}
|
||||
|
||||
$mailer = array();
|
||||
$mailer['host'] = "mail.example.com";
|
||||
|
Loading…
x
Reference in New Issue
Block a user