mirror of
https://github.com/nextcloud/documentation.git
synced 2026-03-27 13:38:39 +07:00
feat(devmanual): Document system email subject and body methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
@@ -45,7 +45,8 @@ Back-end changes
|
||||
Added APIs
|
||||
^^^^^^^^^^
|
||||
|
||||
* tbd
|
||||
* ``\OCP\Mail\IMessage::setSubject`` to set an email subject. See :ref:`email` for an example.
|
||||
* ``\OCP\Mail\IMessage::setHtmlBody`` and ``\OCP\Mail\IMessage::setPlainBody`` to set an email body See :ref:`email` for an example.
|
||||
|
||||
Changed APIs
|
||||
^^^^^^^^^^^^
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.. _email:
|
||||
|
||||
=====
|
||||
Email
|
||||
=====
|
||||
@@ -25,6 +27,11 @@ The mailer is hidden behind the ``\OCP\Mail\IMailer`` interface that can be :ref
|
||||
|
||||
public function notify(string $email): void {
|
||||
$message = $this->mailer->createMessage();
|
||||
$message->setSubject("Hello from Nextcloud");
|
||||
$message->setPlainBody("This is some text");
|
||||
$message->setHtmlBody(
|
||||
"<!doctype html><html><body>This is some <b>text</b></body></html>"
|
||||
);
|
||||
$message->setTo([$email]);
|
||||
$this->mailer->send($message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user