phpmailer.install in PHPMailer 5.2
Same filename and directory in other branches
PHPMailer installation functions.
File
phpmailer.installView source
<?php
/**
* @file
* PHPMailer installation functions.
*/
/**
* Implementation of hook_requirements().
*/
function phpmailer_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time.
$t = get_t();
$path = drupal_get_path('module', 'phpmailer');
if (!file_exists('./' . $path . '/phpmailer/class.phpmailer.php') || !file_exists('./' . $path . '/phpmailer/class.smtp.php')) {
$requirements['phpmailer'] = array(
'title' => $t('PHPMailer library'),
'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/',
'@phpmailer-class-path' => $path . '/phpmailer/class.phpmailer.php',
)),
);
}
else {
if ($phase == 'runtime') {
require_once drupal_get_path('module', 'phpmailer') . '/phpmailer/class.phpmailer.php';
$mail = new PHPMailer();
$requirements['phpmailer'] = array(
'title' => $t('PHPMailer library'),
'value' => $mail->Version,
'severity' => REQUIREMENT_OK,
);
}
}
return $requirements;
}
/**
* Implementation of hook_uninstall().
*/
function phpmailer_uninstall() {
variable_del('smtp_on');
variable_del('smtp_host');
variable_del('smtp_hostbackup');
variable_del('smtp_port');
variable_del('smtp_protocol');
variable_del('smtp_fromname');
variable_del('smtp_username');
variable_del('smtp_password');
variable_del('smtp_keepalive');
variable_del('smtp_debug');
}
Functions
Name | Description |
---|---|
phpmailer_requirements | Implementation of hook_requirements(). |
phpmailer_uninstall | Implementation of hook_uninstall(). |