Added additional error handling.
This commit is contained in:
parent
9316a4eaef
commit
5d7d027e75
@ -97,12 +97,19 @@ class Sendmail_Core {
|
||||
// Gallery Sendmail script. Outside of this function,
|
||||
// no other changes were made.
|
||||
|
||||
require(module::get_var("phpmailer", "phpmailer_path"));
|
||||
// Make sure phpmailer_path is valid.
|
||||
if(!file_exists(module::get_var("phpmailer", "phpmailer_path"))) {
|
||||
Kohana_Log::add("error", wordwrap("File Not Found: " . module::get_var("phpmailer", "phpmailer_path")));
|
||||
return false;
|
||||
}
|
||||
|
||||
require_once(module::get_var("phpmailer", "phpmailer_path"));
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$mail->IsSMTP();
|
||||
$mail->Host = module::get_var("phpmailer", "smtp_server");
|
||||
$mail->Port = module::get_var("phpmailer", "smtp_port");
|
||||
$mail->SMTPDebug = 1;
|
||||
|
||||
if (module::get_var("phpmailer", "smtp_login") != "") {
|
||||
$mail->SMTPAuth = true;
|
||||
@ -133,6 +140,12 @@ class Sendmail_Core {
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $message;
|
||||
|
||||
return $mail->Send();
|
||||
// Log any errors.
|
||||
if (!$mail->Send()) {
|
||||
Kohana_Log::add("error", wordwrap($mail->ErrorInfo));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,12 +97,19 @@ class Sendmail_Core {
|
||||
// Gallery Sendmail script. Outside of this function,
|
||||
// no other changes were made.
|
||||
|
||||
require(module::get_var("phpmailer", "phpmailer_path"));
|
||||
// Make sure phpmailer_path is valid.
|
||||
if(!file_exists(module::get_var("phpmailer", "phpmailer_path"))) {
|
||||
Kohana_Log::add("error", wordwrap("File Not Found: " . module::get_var("phpmailer", "phpmailer_path")));
|
||||
return false;
|
||||
}
|
||||
|
||||
require_once(module::get_var("phpmailer", "phpmailer_path"));
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$mail->IsSMTP();
|
||||
$mail->Host = module::get_var("phpmailer", "smtp_server");
|
||||
$mail->Port = module::get_var("phpmailer", "smtp_port");
|
||||
$mail->SMTPDebug = 1;
|
||||
|
||||
if (module::get_var("phpmailer", "smtp_login") != "") {
|
||||
$mail->SMTPAuth = true;
|
||||
@ -133,6 +140,12 @@ class Sendmail_Core {
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $message;
|
||||
|
||||
return $mail->Send();
|
||||
// Log any errors.
|
||||
if (!$mail->Send()) {
|
||||
Kohana_Log::add("error", wordwrap($mail->ErrorInfo));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user