Skip to content
Merged
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
20 changes: 8 additions & 12 deletions en/core-libraries/email.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ following configuration keys are used:
- ``'theme'``: Theme used when rendering template. See ``Email::theme()``.
- ``'layout'``: If you are using rendered content, set the layout to render. If
you want to render a template without layout, set this field to null. See
``Email::layout()``.
``Email::template()``.
- ``'viewVars'``: If you are using rendered content, set the array with
variables to be used in the view. See ``Email::viewVars()``.
- ``'attachments'``: List of files to attach. See ``Email::attachments()``.
Expand Down Expand Up @@ -250,8 +250,7 @@ and elements just like normal views::

$email = new Email();
$email
->template('welcome')
->layout('fancy')
->template('welcome', 'fancy')
->emailFormat('html')
->to('bob@example.com')
->from('app@domain.com')
Expand All @@ -263,8 +262,7 @@ send multipart templated email messages as well::

$email = new Email();
$email
->template('welcome')
->layout('fancy')
->template('welcome', 'fancy')
->emailFormat('both')
->to('bob@example.com')
->from('app@domain.com')
Expand Down Expand Up @@ -302,8 +300,7 @@ If you want to send email using templates in a plugin you can use the familiar
:term:`plugin syntax` to do so::

$email = new Email();
$email->template('Blog.new_comment');
$email->layout('Blog.auto_message');
$email->template('Blog.new_comment', 'Blog.auto_message');

The above would use template and layout from the Blog plugin as an example.

Expand All @@ -312,8 +309,7 @@ You can do this using themes by telling Email to use appropriate theme using
``Email::theme()`` method::

$email = new Email();
$email->template('Blog.new_comment');
$email->layout('Blog.auto_message');
$email->template('Blog.new_comment', 'Blog.auto_message');
$email->theme('TestTheme');

This allows you to override the ``new_comment`` template in your theme without
Expand All @@ -323,7 +319,8 @@ following path:

.. deprecated:: 3.4.0
Use ``setTemplate()`` instead of ``template()``. Use ``setLayout()`` instead
of ``layout()``. Use ``setTheme()`` instead of ``theme()``.
of the layout argument of ``template()``. Use ``setTheme()`` instead of
``theme()``.


Sending Attachments
Expand Down Expand Up @@ -521,8 +518,7 @@ following::
$this
->to($user->email)
->subject(sprintf('Welcome %s', $user->name))
->template('welcome_mail') // By default template with same name as method name is used.
->layout('custom');
->template('welcome_mail', 'custom'); // By default template with same name as method name is used.
}

public function resetPassword($user)
Expand Down