Last active
March 27, 2019 20:26
-
-
Save hh-com/32a688b5f8e29cd2282f84bc43218f5a to your computer and use it in GitHub Desktop.
Workaround for Swiftmailer Easyname - Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php | |
private function _establishSocketConnection() | |
{ | |
$host = $this->_params['host']; | |
if (!empty($this->_params['protocol'])) { | |
$host = $this->_params['protocol'].'://'.$host; | |
} | |
$timeout = 15; | |
if (!empty($this->_params['timeout'])) { | |
$timeout = $this->_params['timeout']; | |
} | |
$options = array(); | |
if (!empty($this->_params['sourceIp'])) { | |
$options['socket']['bindto'] = $this->_params['sourceIp'].':0'; | |
} | |
if (isset($this->_params['stream_context_options'])) { | |
$options = array_merge($options, $this->_params['stream_context_options']); | |
} | |
$streamContext = stream_context_create($options); | |
#$this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext); | |
$this->_stream = fsockopen($host.':'.$this->_params['port'], $errno, $errstr, $timeout); | |
if (false === $this->_stream) { | |
throw new Swift_TransportException( | |
'Connection could not be established with host '.$this->_params['host']. | |
' ['.$errstr.' #'.$errno.']' | |
); | |
} | |
if (!empty($this->_params['blocking'])) { | |
stream_set_blocking($this->_stream, 1); | |
} else { | |
stream_set_blocking($this->_stream, 0); | |
} | |
$timeout = 15; | |
stream_set_timeout($this->_stream, $timeout); | |
$this->_in = &$this->_stream; | |
$this->_out = &$this->_stream; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment