Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -66,15 +66,6 @@ class _SMTP extends \IPS\Email
|
||||
*/
|
||||
public function connect()
|
||||
{
|
||||
$tls = FALSE;
|
||||
|
||||
/* Check for tls:// in the hostname */
|
||||
if ( mb_strpos( \IPS\Settings::i()->smtp_host, 'tls://' ) !== FALSE )
|
||||
{
|
||||
$tls = TRUE;
|
||||
\IPS\Settings::i()->smtp_host = mb_substr( \IPS\Settings::i()->smtp_host, 6 );
|
||||
}
|
||||
|
||||
/* Do we already have a connection? */
|
||||
if( static::$smtp !== NULL )
|
||||
{
|
||||
@@ -82,7 +73,7 @@ class _SMTP extends \IPS\Email
|
||||
}
|
||||
|
||||
/* Connect */
|
||||
static::$smtp = @fsockopen( \IPS\Settings::i()->smtp_host, \IPS\Settings::i()->smtp_port, $errno, $errstr );
|
||||
static::$smtp = @fsockopen( ( ( \IPS\Settings::i()->smtp_protocol == 'ssl' ) ? 'ssl://' : '' ) . \IPS\Settings::i()->smtp_host, \IPS\Settings::i()->smtp_port, $errno, $errstr );
|
||||
|
||||
if ( !static::$smtp )
|
||||
{
|
||||
@@ -100,28 +91,20 @@ class _SMTP extends \IPS\Email
|
||||
throw new \IPS\Email\Outgoing\Exception( \IPS\Member::loggedIn()->language()->addToStack('smtpmail_fsock_error_initial', FALSE, array( 'sprintf' => array( $responseCode ) ) ) );
|
||||
}
|
||||
|
||||
/* If we use ssl:// we need to strip that out */
|
||||
$host = \IPS\Settings::i()->smtp_host;
|
||||
|
||||
if( mb_strpos( \IPS\Settings::i()->smtp_host, '://' ) !== FALSE )
|
||||
{
|
||||
$host = mb_substr( \IPS\Settings::i()->smtp_host, mb_strpos( \IPS\Settings::i()->smtp_host, '://' ) + 3 );
|
||||
}
|
||||
|
||||
/* HELO/EHLO */
|
||||
try
|
||||
{
|
||||
$helo = 'EHLO';
|
||||
$responseCode = $this->_sendCommand( 'EHLO ' . $host, 250 );
|
||||
$responseCode = $this->_sendCommand( 'EHLO ' . \IPS\Settings::i()->smtp_host, 250 );
|
||||
}
|
||||
catch ( \IPS\Email\Outgoing\Exception $e )
|
||||
{
|
||||
$helo = 'HELO';
|
||||
$responseCode = $this->_sendCommand( 'HELO ' . $host, 250 );
|
||||
$responseCode = $this->_sendCommand( 'HELO ' . \IPS\Settings::i()->smtp_host, 250 );
|
||||
}
|
||||
|
||||
/* Is TLS being used? */
|
||||
if( $tls === TRUE )
|
||||
if( \IPS\Settings::i()->smtp_protocol == 'tls' )
|
||||
{
|
||||
$this->_sendCommand( 'STARTTLS', 220 );
|
||||
|
||||
@@ -131,7 +114,7 @@ class _SMTP extends \IPS\Email
|
||||
}
|
||||
|
||||
/* Exchange server (at least) wants EHLO resending for STARTTLS */
|
||||
$this->_sendCommand( $helo . ' ' . $host, 250 );
|
||||
$this->_sendCommand( $helo . ' ' . \IPS\Settings::i()->smtp_host, 250 );
|
||||
}
|
||||
|
||||
/* Authenticate */
|
||||
|
||||
Reference in new issue
Block a user