From b9863a153c4a9295c3ddd214c1c1d21aa4807221 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 16 Apr 2013 16:40:04 +0400 Subject: [PATCH] unify SMTP_HOST and SMTP_PORT as SMTP_SERVER --- classes/ttrssmailer.php | 19 +++++++++++-------- config.php-dist | 8 +++----- include/sanity_config.php | 4 ++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/classes/ttrssmailer.php b/classes/ttrssmailer.php index 1eb9f1d3a..1f365c22e 100644 --- a/classes/ttrssmailer.php +++ b/classes/ttrssmailer.php @@ -25,17 +25,20 @@ class ttrssMailer extends PHPMailer { function __construct() { $this->SetLanguage("en", "lib/phpmailer/language/"); - //if SMTP_HOST is specified, use SMTP to send mail directly + if (SMTP_HOST) { - $Host = SMTP_HOST; + $pair = explode(":", SMTP_HOST, 2); $Mailer = "smtp"; + + $Host = $pair[0]; + $Port = $pair[1]; + + if (!$Port) $Port = 25; + } else { + $Host = ''; + $Port = ''; } - //if SMTP_PORT is specified, assign it. Otherwise default to port 25 - if(SMTP_PORT){ - $Port = SMTP_PORT; - }else{ - $Port = "25"; - } + //if SMTP_LOGIN is specified, set credentials and enable auth if(SMTP_LOGIN){ diff --git a/config.php-dist b/config.php-dist index fc999354b..5366120af 100644 --- a/config.php-dist +++ b/config.php-dist @@ -160,12 +160,10 @@ define('DIGEST_SUBJECT', '[tt-rss] New headlines for last 24 hours'); // Subject line for email digests - define('SMTP_HOST', ''); - // SMTP Host to send outgoing mail. Blank - use system MTA. + define('SMTP_SERVER', ''); + // Hostname:port combination to send outgoing mail (i.e. localhost:25). + // Blank - use system MTA. - define('SMTP_PORT',''); - // SMTP port to sent outgoing mail. Default is 25. - define('SMTP_LOGIN', ''); define('SMTP_PASSWORD', ''); // These two options enable SMTP authentication when sending diff --git a/include/sanity_config.php b/include/sanity_config.php index 0c829981e..255b404d6 100644 --- a/include/sanity_config.php +++ b/include/sanity_config.php @@ -1,3 +1,3 @@ - +$requred_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'FEED_CRYPT_KEY', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'PUBSUBHUBBUB_HUB', 'PUBSUBHUBBUB_ENABLED', 'SPHINX_ENABLED', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SESSION_CHECK_ADDRESS', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'SMTP_SERVER', 'SMTP_LOGIN', 'SMTP_PASSWORD', 'CHECK_FOR_NEW_VERSION', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'CONFIG_VERSION'); ?>