Permalink
Browse files

Add Pop-Before-Smtp Connection (#201)

* Add Pop-Before-Smtp Connection

* Re-use the existing smtp fields - PHPMAILERHOST…

* code review

* debug$
  • Loading branch information...
jd440 authored and michield committed Dec 3, 2017
1 parent 5bac09d commit a953553b86a89b97a04c69a4184b7fea2de57d57
@@ -117,14 +117,32 @@ public function __construct($messageid, $email, $inBlast = true, $exceptions = f
}
//logEvent('Sending email via '.PHPMAILERHOST);
$this->Host = PHPMAILERHOST;
if (isset($GLOBALS['phpmailer_smtpuser']) && $GLOBALS['phpmailer_smtpuser'] != ''
&& isset($GLOBALS['phpmailer_smtppassword']) && $GLOBALS['phpmailer_smtppassword']
) {
$this->Username = $GLOBALS['phpmailer_smtpuser'];
$this->Password = $GLOBALS['phpmailer_smtppassword'];
$this->SMTPAuth = true;
}
$this->Mailer = 'smtp';
if (POP_BEFORE_SMTP) {
// authenticate using the smtp user and password
$pop = new POP3();
if (!$pop->authorise(PHPMAILERHOST, $this->Port, 30, $GLOBALS['phpmailer_smtpuser'], $GLOBALS['phpmailer_smtppassword'], 1)) {
// unable to authenticate, there might be an error message in $pop->getErrors()
$poperror = $pop->getErrors();
if (POPBEFORESMTP_DEBUG) {
$this->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$this->Debugoutput = 'html';
}
}
} else {
// the existing smtp code
if (isset($GLOBALS['phpmailer_smtpuser']) && $GLOBALS['phpmailer_smtpuser'] != ''
&& isset($GLOBALS['phpmailer_smtppassword']) && $GLOBALS['phpmailer_smtppassword']
) {
$this->Username = $GLOBALS['phpmailer_smtpuser'];
$this->Password = $GLOBALS['phpmailer_smtppassword'];
$this->SMTPAuth = true;
}
}
$this->Mailer = 'smtp';
} elseif (USE_AMAZONSES) {
$this->Mailer = 'amazonSes';
} elseif (USE_LOCAL_SPOOL && is_dir(USE_LOCAL_SPOOL) && is_writable(USE_LOCAL_SPOOL)) {
@@ -586,6 +586,12 @@
if (!defined('PHPMAILER_SMTP_DEBUG')) {
define('PHPMAILER_SMTP_DEBUG', 0);
}
if (!defined('POP_BEFORE_SMTP')) {
define('POP_BEFORE_SMTP', '');
}
if (!defined('POPBEFORESMTP_DEBUG')) {
define('POPBEFORESMTP_DEBUG', '');
}
if (!defined('USERSPAGE_MAX')) {
define('USERSPAGE_MAX', 1000);
}
@@ -594,6 +594,12 @@
//# defaults to 5 seconds
// define('SMTP_TIMEOUT',5);
// Pop-Before-Smtp
// If you use Pop before Smtp, set to true
// And complete smtp settings (PHPMAILERHOST, phpmailer_smtpuser', phpmailer_smtppassword)
define('POP_BEFORE_SMTP', false);
define('POPBEFORESMTP_DEBUG', false);
/*
=========================================================================
@@ -843,3 +849,4 @@
// Allow admin to enter a different message that will be sent when forwarding 'to a friend'
// This will show an extra tab in the message dialog.
define('FORWARD_ALTERNATIVE_CONTENT', 0);

0 comments on commit a953553

Please sign in to comment.