From 44d682965c8ef62a08cca6c060bcbe27c8961dd9 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 8 Apr 2016 09:01:10 -0700 Subject: [PATCH] PHPMailer updated to v5.2.13. Cleaned up SMTP options in the admin area. --- e107_admin/mailout.php | 209 +-- e107_admin/prefs.php | 127 +- e107_core/xml/default_install.xml | 1 + e107_handlers/form_handler.php | 13 +- e107_handlers/mail.php | 66 +- e107_handlers/mailout_admin_class.php | 132 ++ e107_handlers/phpmailer/class.phpmailer.php | 1174 +++++++++++------ .../phpmailer/class.phpmaileroauth.php | 197 +++ .../phpmailer/class.phpmaileroauthgoogle.php | 70 + e107_handlers/phpmailer/class.pop3.php | 138 +- e107_handlers/phpmailer/class.smtp.php | 629 ++++++--- e107_handlers/phpmailer/get_oauth_token.php | 64 + e107_handlers/phpmailer/mailout_process.php | 509 ------- e107_languages/English/admin/lan_mailout.php | 2 +- 14 files changed, 1755 insertions(+), 1576 deletions(-) create mode 100644 e107_handlers/phpmailer/class.phpmaileroauth.php create mode 100644 e107_handlers/phpmailer/class.phpmaileroauthgoogle.php create mode 100644 e107_handlers/phpmailer/get_oauth_token.php delete mode 100644 e107_handlers/phpmailer/mailout_process.php diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php index 478f4cab5..b6552b370 100644 --- a/e107_admin/mailout.php +++ b/e107_admin/mailout.php @@ -178,6 +178,10 @@ if($_GET['mode']=="process") */ + + + + class mailout_admin extends e_admin_dispatcher { @@ -1061,84 +1065,19 @@ class mailout_main_ui extends e_admin_ui // $text .= "  {$mailer}
"; } } - - $text .= " + + + + + $text .= " ".LAN_MAILOUT_115."
- - ".LAN_MAILOUT_116."
"; + "; - -// SMTP. --------------> - $smtp_opts = explode(',',varset($pref['smtp_options'],'')); - $smtpdisp = ($pref['mailer'] != 'smtp') ? "style='display:none;'" : ''; - $text .= "
- - - - - - "; - $text .= " - - - - - - - - - - - - - - - - - "; - - $text .= " - - "; - - $checked = (in_array('useVERP',$smtp_opts) ? "checked='checked'" : ""); - $text .= " - - -
".LAN_MAILOUT_87.":   - -
".LAN_MAILOUT_88.": (".LAN_OPTIONAL.")   - -
".LAN_MAILOUT_89.": (".LAN_OPTIONAL.")   - -
".LAN_MAILOUT_90." - \n
".LAN_MAILOUT_94."
".LAN_MAILOUT_57." - "; - $checked = (vartrue($pref['smtp_keepalive']) ) ? "checked='checked'" : ''; - $text .= " -
".LAN_MAILOUT_95." - -
"; + $text .= mailoutAdminClass::mailerPrefsTable($pref); /* FIXME - posting SENDMAIL path triggers Mod-Security rules. @@ -1402,6 +1341,7 @@ class mailout_main_ui extends e_admin_ui $temp['smtp_server'] = $tp->toDB($_POST['smtp_server']); $temp['smtp_username'] = $tp->toDB($_POST['smtp_username']); $temp['smtp_password'] = $tp->toDB($_POST['smtp_password']); + $temp['smtp_port'] = intval($_POST['smtp_port']); $smtp_opts = array(); switch (trim($_POST['smtp_options'])) @@ -2385,114 +2325,8 @@ function sendImmediately($id) // MAILER OPTIONS //---------------------------------------------------- /* -function show_prefs($mailAdmin) -{ - return; - - $pref = e107::getPref(); - $e107 = e107::getInstance(); - $frm = e107::getForm(); - $mes = e107::getMessage(); - $ns = e107::getRender(); - e107::getCache()->CachePageMD5 = '_'; - $lastload = e107::getCache()->retrieve('emailLastBounce',FALSE,TRUE,TRUE); - $lastBounce = round((time() - $lastload) / 60); - - $lastBounceText = ($lastBounce > 1256474) ? "Never" : "".$lastBounce . " minutes ago."; - - $text = " -
-
- ".LAN_MAILOUT_110." - - - - - - - - - - - - - -
".LAN_MAILOUT_110."
".$frm->admin_button('testemail', LAN_MAILOUT_112,'other')."  - -
".LAN_MAILOUT_115."
- ".LAN_MAILOUT_116."
"; - - - -// SMTP. --------------> - $smtp_opts = explode(',',varset($pref['smtp_options'],'')); - $smtpdisp = ($pref['mailer'] != 'smtp') ? "style='display:none;'" : ''; - $text .= "
- - - - - - "; - $text .= " - - - - - - - - - - - - - - - - - "; - - $text .= " - - "; - - $checked = (in_array('useVERP',$smtp_opts) ? "checked='checked'" : ""); - $text .= " - - -
".LAN_MAILOUT_87.":   - -
".LAN_MAILOUT_88.": (".LAN_OPTIONAL.")   - -
".LAN_MAILOUT_89.": (".LAN_OPTIONAL.")   - -
".LAN_MAILOUT_90." - \n
".LAN_MAILOUT_94."
".LAN_MAILOUT_57." - "; - $checked = (varsettrue($pref['smtp_keepalive']) ) ? "checked='checked'" : ''; - $text .= " -
".LAN_MAILOUT_95." - -
"; -*/ /* FIXME - posting SENDMAIL path triggers Mod-Security rules. // Sendmail. --------------> $senddisp = ($pref['mailer'] != 'sendmail') ? "style='display:none;'" : ''; @@ -2747,25 +2581,6 @@ function headerjs() $text = " \n"; - -/* if($cur != $prev) - { // Update 'completed' segment of progress bar - echo "\n"; - } - $prev = $cur; -*/ ob_flush(); - flush(); - - if($pause_count > $pause_amount) - { - sleep($pause_time); - $pause_count = 1; - } - - // Default sleep to reduce server-load: 1 second. - sleep(1); - - $c++; - $pause_count++; - } - ob_end_flush(); - - echo "

"; - echo LAN_MAILOUT_62." ".$send_ok."
"; - echo LAN_MAILOUT_63." ".$send_fail."
"; - echo LAN_MAILOUT_64." ".stopwatch()." ".LAN_MAILOUT_65."
"; - echo "
"; - -// Complete - need to log something against the mailshot entry, and maybe write an admin log entry. - $log_string = date("H:i:s d.m.y")." End of ".($logenable == 1 ? 'debug ' : '')."mail run by ".USERNAME." - {$send_ok} succeeded, {$send_fail} failed. Subject: ".$mail_subject; - if (!is_array($email_info['send_results'])) $email_info['send_results'] = array(); - $email_info['send_results'][] = $log_string; - $sql->db_Update('generic',"`gen_chardata`='".serialize($email_info)."' WHERE `gen_id` = {$mail_text_id} AND `gen_type`='savemail' and `gen_datestamp` = '".$mail_id."' "); - - $mail->ClearAttachments(); - - if ($pref['mailer']== 'smtp') - { - $mail->SmtpClose(); - } - -echo "
-
-
"; -echo ""; - -if ($logenable) -{ - fwrite($loghandle,$log_string."\r\n"); - fclose($loghandle); -} - - - - - -function headerjs(){ - $text = " - "; - -$text .= " - "; - - return $text; -} - - -function stopwatch(){ - static $mt_previous = 0; - list($usec, $sec) = explode(" ",microtime()); - $mt_current = (float)$usec + (float)$sec; - if (!$mt_previous) { - $mt_previous = $mt_current; - return ""; - } else { - $mt_diff = ($mt_current - $mt_previous); - $mt_previous = $mt_current; - return round(sprintf('%.16f',$mt_diff),2); - } -} -?> diff --git a/e107_languages/English/admin/lan_mailout.php b/e107_languages/English/admin/lan_mailout.php index 8ea65f180..d55984c16 100644 --- a/e107_languages/English/admin/lan_mailout.php +++ b/e107_languages/English/admin/lan_mailout.php @@ -274,7 +274,7 @@ define("LAN_MAILOUT_255", "Templated Email, ID: "); define("LAN_MAILOUT_256", "Return"); define("LAN_MAILOUT_257", "Generated template"); //define("LAN_MAILOUT_258", "Template: ");//LAN_TEMPLATE -define("LAN_MAILOUT_259", ""); +define("LAN_MAILOUT_260", "SMTP Port"); define("LAN_SEND", "Send");