From b7131f34e1bc43ee4d0f5f7665b05aea4cbfe8be Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 19 Dec 2020 20:31:52 +0100 Subject: [PATCH] continue drafting mail handler --- Message/Mail/Email.php | 4 ++-- Message/Mail/MailHandler.php | 19 ++++++------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Message/Mail/Email.php b/Message/Mail/Email.php index cb4fb1233..2ed6e0306 100644 --- a/Message/Mail/Email.php +++ b/Message/Mail/Email.php @@ -1292,8 +1292,8 @@ class Email implements MessageInterface return ''; } - $fileBuffer = file_get_contents($path); - if (false === $fileBuffer) { + $fileBuffer = \file_get_contents($path); + if ($fileBuffer === false) { return ''; } diff --git a/Message/Mail/MailHandler.php b/Message/Mail/MailHandler.php index de4cd54ce..03483ee45 100644 --- a/Message/Mail/MailHandler.php +++ b/Message/Mail/MailHandler.php @@ -322,8 +322,6 @@ class MailHandler default: return false; } - - return false; } /** @@ -361,11 +359,8 @@ class MailHandler \fwrite($con, $mail->bodyMime); $result = \pclose($con); - if ($result !== 0) { - return false; - } - return true; + return $result === 0; } /** @@ -391,7 +386,10 @@ class MailHandler //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver // CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped. $params = null; - if (!empty($mail->sender) && EmailValidator::isValid($mail->sender) && StringUtils::isShellSafe($mail->sender)) { + if (!empty($mail->sender) + && EmailValidator::isValid($mail->sender) + && StringUtils::isShellSafe($mail->sender) + ) { $params = \sprintf('-f%s', $mail->sender); } @@ -400,7 +398,6 @@ class MailHandler \ini_set('sendmail_from', $mail->sender); } - $result = false; $result = $this->mailPassthru($to, $mail, $header, $params); if (isset($oldFrom)) { @@ -478,11 +475,7 @@ class MailHandler $this->smtp->close(); } - if (!empty($badRcpt)) { - return false; - } - - return true; + return empty($badRcpt); } /**