Commit cc29cf56 authored by smk-ka's avatar smk-ka

by smk-ka: Improved installation and status report page error message in case...

by smk-ka: Improved installation and status report page error message in case the PHPMailer library is missing.
parent 01d7f316
......@@ -2,6 +2,8 @@
PHPMailer 6.x-3.x, xxxx-xx-xx
-----------------------------
by smk-ka: Improved installation and status report page error message in case
the PHPMailer library is missing.
by smk-ka: Improved integration with Mime Mail.
by smk-ka: Removed bogus call to hook_mail_alter() from phpmailer_preview().
by smk-ka: Display a warning message if PHPMailer is disabled.
......
......@@ -14,33 +14,30 @@ function phpmailer_requirements($phase) {
// Ensure translations don't break at install time.
$t = get_t();
if ($phase == 'install') {
if ($phase == 'runtime' && phpmailer_load_library()) {
$mail = new PHPMailer();
$requirements['phpmailer'] = array(
'title' => $t('PHPMailer library'),
'value' => $mail->Version,
'severity' => REQUIREMENT_OK,
);
}
else {
drupal_load('module', 'libraries');
$path = libraries_get_path('phpmailer');
if (!file_exists('./' . $path . '/class.phpmailer.php') || !file_exists('./' . $path . '/class.smtp.php')) {
$requirements['phpmailer'] = array(
'title' => $t('PHPMailer library'),
'value' => $t('Missing'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('PHPMailer module requires the <a href="@phpmailer-url">PHPMailer</a> library to properly send mail. Please download the PHPMailer package for PHP5/6, extract the archive and copy its contents to the following location: @phpmailer-path. Make sure the main PHPMailer class is located at @phpmailer-class-path.', array(
'@phpmailer-url' => 'http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/',
'@phpmailer-path' => $path,
'@phpmailer-class-path' => $path . '/class.phpmailer.php',
'description' => $t('Please download <a href="@url">PHPMailer for PHP5/6</a>, extract the archive and copy the contents to the following location:<br /><code>@path</code>. Make sure the main file, class.phpmailer.php, is located at<br /><code>@class</code>.', array(
'@url' => 'http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/',
'@path' => $path,
'@class' => $path . '/class.phpmailer.php',
)),
);
}
}
else if ($phase == 'runtime') {
$requirements['phpmailer'] = array('title' => $t('PHPMailer library'));
if (phpmailer_load_library()) {
$mail = new PHPMailer();
$requirements['phpmailer']['value'] = $mail->Version;
$requirements['phpmailer']['severity'] = REQUIREMENT_OK;
}
else {
$requirements['phpmailer']['value'] = $t('missing');
$requirements['phpmailer']['severity'] = REQUIREMENT_ERROR;
}
}
return $requirements;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment