Don't fallback to Plaintext per default for legacy class

This commit is contained in:
Lukas Reschke 2015-03-16 14:10:03 +01:00
parent d7c7808a5e
commit 7a70fffa6c
1 changed files with 15 additions and 6 deletions

View File

@ -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);