summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Douma <rullzer@users.noreply.github.com>2016-04-25 21:58:54 +0200
committerRoeland Douma <rullzer@users.noreply.github.com>2016-04-25 21:58:54 +0200
commit6938cfc9e39617b523995b9860f0944e4fa1efae (patch)
treeccdbf1e9b4e0c4812b49795f9e2d4519bdc9175a /lib
parent5e57d3a0b9c42df1413c4d2245faf1bbbe768a63 (diff)
parenta18c8a7da0551b4afab913c1b60d2f8f9ab154a7 (diff)
downloadnextcloud-server-6938cfc9e39617b523995b9860f0944e4fa1efae.tar.gz
nextcloud-server-6938cfc9e39617b523995b9860f0944e4fa1efae.zip
Merge pull request #24251 from owncloud/fix-mailer
Allow automatic dependency injection for OCP\Mail\Mailer
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php4
-rw-r--r--lib/public/mail/imailer.php7
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php
index f74fe4aeb99..2951ee536d2 100644
--- a/lib/private/AppFramework/DependencyInjection/DIContainer.php
+++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php
@@ -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();
});
diff --git a/lib/public/mail/imailer.php b/lib/public/mail/imailer.php
index 61eb895752b..e3c751277ac 100644
--- a/lib/public/mail/imailer.php
+++ b/lib/public/mail/imailer.php
@@ -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