diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-03-16 14:10:03 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-03-16 14:10:03 +0100 |
commit | 7a70fffa6cd1597e588111cd39054b80adf296c0 (patch) | |
tree | 2fff8d2acf7b1c892124dd426ee28518fc133464 /lib/public/util.php | |
parent | d7c7808a5e789180f86259ef6a91b17c1bcf737b (diff) | |
download | nextcloud-server-7a70fffa6cd1597e588111cd39054b80adf296c0.tar.gz nextcloud-server-7a70fffa6cd1597e588111cd39054b80adf296c0.zip |
Don't fallback to Plaintext per default for legacy class
Diffstat (limited to 'lib/public/util.php')
-rw-r--r-- | lib/public/util.php | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/public/util.php b/lib/public/util.php index 338c216f255..5efdcc55de4 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -65,26 +65,35 @@ class Util { * @param string $bcc * @deprecated Use \OCP\Mail\IMailer instead */ - public static function sendMail( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, + public static function sendMail($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '') { $mailer = \OC::$server->getMailer(); $message = $mailer->createMessage(); - $message->setTo(array($toaddress => $toname)); + $message->setTo([$toaddress => $toname]); $message->setSubject($subject); $message->setPlainBody($mailtext); - $message->setFrom(array($fromaddress => $fromname)); + $message->setFrom([$fromaddress => $fromname]); if($html === 1) { $message->setHTMLBody($altbody); } + + if($altbody === '') { + $message->setHTMLBody($mailtext); + $message->setPlainBody(''); + } else { + $message->setHtmlBody($mailtext); + $message->setPlainBody($altbody); + } + if(!empty($ccaddress)) { if(!empty($ccname)) { - $message->setCc(array($ccaddress => $ccname)); + $message->setCc([$ccaddress => $ccname]); } else { - $message->setCc(array($ccaddress)); + $message->setCc([$ccaddress]); } } if(!empty($bcc)) { - $message->setBcc(array($bcc)); + $message->setBcc([$bcc]); } $mailer->send($message); |