Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^^^^
Expand Down
7 changes: 7 additions & 0 deletions developer_manual/digging_deeper/email.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _email:

=====
Email
=====
Expand Down Expand Up @@ -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);
}
Expand Down