Commit 6938cfc9 authored by Roeland Douma's avatar Roeland Douma
Browse files

Merge pull request #24251 from owncloud/fix-mailer

Allow automatic dependency injection for OCP\Mail\Mailer
parents 5e57d3a0 a18c8a7d
......@@ -175,6 +175,10 @@ class DIContainer extends SimpleContainer implements IAppContainer {
return $this->getServer()->getMimeTypeDetector();
});
$this->registerService('OCP\\Mail\\IMailer', function() {
return $this->getServer()->getMailer();
});
$this->registerService('OCP\\INavigationManager', function($c) {
return $this->getServer()->getNavigationManager();
});
......
......@@ -32,9 +32,10 @@ use OC\Mail\Message;
* $mailer = \OC::$server->getMailer();
* $message = $mailer->createMessage();
* $message->setSubject('Your Subject');
* $message->setFrom(array('cloud@domain.org' => 'ownCloud Notifier');
* $message->setTo(array('recipient@domain.org' => 'Recipient');
* $message->setBody('The message text');
* $message->setFrom(['cloud@domain.org' => 'ownCloud Notifier']);
* $message->setTo(['recipient@domain.org' => 'Recipient']);
* $message->setPlainBody('The message text');
* $message->setHtmlBody('The <strong>message</strong> text');
* $mailer->send($message);
*
* This message can then be passed to send() of \OC\Mail\Mailer
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment