8000 Adding a section to emailing showing off absolute_url · symfony/symfony-docs@8fd796f · GitHub
[go: up one dir, main page]

Skip to content

Commit 8fd796f

Browse files
committed
Adding a section to emailing showing off absolute_url
1 parent 39f6876 commit 8fd796f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

cookbook/email/email.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,21 @@ an email is pretty straightforward::
123123
}
124124

125125
To keep things decoupled, the email body has been stored in a template and
126-
rendered with the ``renderView()`` method.
126+
rendered with the ``renderView()`` method. The ``registration.html.twig``
127+
template might look something like this:
128+
129+
.. code-block:: html+jinja
130+
131+
{# app/Resources/views/Emails/registration.html.twig #}
132+
<h3>You did it! You registered!</h3>
133+
134+
{# example, assuming you have a route named "login" $}
135+
To login, go to: {{ url('login') }}.
136+
137+
Thanks!
138+
139+
{# Makes an absolute URL to the /images/logo.png file #}
140+
<img src="{{ absolute_url(asset('images/logo.png')) }}"
127141

128142
The ``$message`` object supports many more options, such as including attachments,
129143
adding HTML content, and much more. Fortunately, Swift Mailer covers the topic

0 commit comments

Comments
 (0)
0