Don't fallback to Plaintext per default for legacy class
This commit is contained in:
parent
d7c7808a5e
commit
7a70fffa6c
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue