From dd1ff120798934513d3bd5877358a34b7ed4dc58 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 14 Apr 2014 16:37:24 +0200 Subject: [PATCH] Fix SMTP delivery of email containing . --- .../files/lib/system/mail/SMTPMailSender.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/mail/SMTPMailSender.class.php b/wcfsetup/install/files/lib/system/mail/SMTPMailSender.class.php index 3c606b56b1..772903b191 100644 --- a/wcfsetup/install/files/lib/system/mail/SMTPMailSender.class.php +++ b/wcfsetup/install/files/lib/system/mail/SMTPMailSender.class.php @@ -2,6 +2,7 @@ namespace wcf\system\mail; use wcf\system\exception\SystemException; use wcf\system\io\RemoteFile; +use wcf\util\StringUtil; /** * Sends a Mail with a connection to a smtp server. @@ -193,7 +194,15 @@ class SMTPMailSender extends MailSender { $this->write($header); $this->write(""); - $this->write($mail->getBody()); + $lines = explode(Mail::$lineEnding, $mail->getBody()); + foreach ($lines as $line) { + // 4.5.2 Transparency + // o Before sending a line of mail text, the SMTP client checks the + // first character of the line. If it is a period, one additional + // period is inserted at the beginning of the line. + if (StringUtil::startsWith($line, '.')) $line = '.'.$line; + $this->write($line); + } $this->write("."); $this->getSMTPStatus(); -- 2.20.1