diff --git a/3.0/modules/phpmailer/libraries/Sendmail.php b/3.0/modules/phpmailer/libraries/Sendmail.php index 95ed8a9d..8735c2b2 100644 --- a/3.0/modules/phpmailer/libraries/Sendmail.php +++ b/3.0/modules/phpmailer/libraries/Sendmail.php @@ -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; + } } } diff --git a/3.1/modules/phpmailer/libraries/Sendmail.php b/3.1/modules/phpmailer/libraries/Sendmail.php index 95ed8a9d..8735c2b2 100644 --- a/3.1/modules/phpmailer/libraries/Sendmail.php +++ b/3.1/modules/phpmailer/libraries/Sendmail.php @@ -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; + } } }