diff --git a/src/Mail/Message.php b/src/Mail/Message.php index 3a550ae1..ef9611df 100644 --- a/src/Mail/Message.php +++ b/src/Mail/Message.php @@ -399,7 +399,7 @@ protected function buildText($html) $text = Strings::replace($html, array( '#<(style|script|head).*#Uis' => '', '#]#i' => ' $0', - '#]*href=("|\')([^\\1]+)\\1[^>]*>(.*?)#i' => '$3 <$2>', + '#]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)#i' => '$2 <$1>', '#[\r\n]+#' => ' ', '#<(/?p|/?h\d|li|br|/tr)[ >/]#i' => "\n$0", )); diff --git a/src/Mail/SmtpMailer.php b/src/Mail/SmtpMailer.php index 7046f8b9..c7d70189 100644 --- a/src/Mail/SmtpMailer.php +++ b/src/Mail/SmtpMailer.php @@ -114,9 +114,9 @@ public function send(Message $mail) */ protected function connect() { - $this->connection = @fsockopen( // intentionally @ - ($this->secure === 'ssl' ? 'ssl://' : '') . $this->host, - $this->port, $errno, $error, $this->timeout + $this->connection = @stream_socket_client( // @ is escalated to exception + ($this->secure === 'ssl' ? 'ssl://' : '') . $this->host . ':' . $this->port, + $errno, $error, $this->timeout ); if (!$this->connection) { throw new SmtpException($error, $errno); diff --git a/tests/Mail/Mail.HtmlBodyAndLinks.phpt b/tests/Mail/Mail.HtmlBodyAndLinks.phpt index 6173d8e0..3b4c30cf 100644 --- a/tests/Mail/Mail.HtmlBodyAndLinks.phpt +++ b/tests/Mail/Mail.HtmlBodyAndLinks.phpt @@ -19,7 +19,7 @@ $mail->setFrom('John Doe '); $mail->addTo('Lady Jane '); $mail->setSubject('Hello Jane!'); -$mail->setHTMLBody('Příliš žluťoučký' . +$mail->setHTMLBody('Příliš žluťoučký "' . '
kůň
'); $mailer = new TestMailer(); @@ -40,13 +40,13 @@ Content-Type: multipart/alternative; Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Příliš žluťoučký +Příliš žluťoučký " kůň ----------%S% Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit -Příliš žluťoučký
kůň
+Příliš žluťoučký "
kůň
----------%S%-- EOD , TestMailer::$output);