Skip to content

Commit

Permalink
feature #4941 Adding a section to emailing showing off absolute_url (…
Browse files Browse the repository at this point in the history
…weaverryan)

This PR was merged into the 2.7 branch.

Discussion
----------

Adding a section to emailing showing off absolute_url

Hi guys!

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | no (but follows from symfony/symfony#13264)
| Applies to    | 2.7+
| Fixed tickets | n/a

I thought we should show off `absolute_url` in a place where you will commonly need it.

Thanks!

Commits
-------

67efb2b minor tweak thanks to Javier
5ab1adf Adding a section to emailing showing off absolute_url
  • Loading branch information
weaverryan committed Mar 13, 2015
2 parents 2b87b47 + 67efb2b commit 78733c3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cookbook/email/email.rst
Expand Up @@ -123,7 +123,21 @@ an email is pretty straightforward::
}

To keep things decoupled, the email body has been stored in a template and
rendered with the ``renderView()`` method.
rendered with the ``renderView()`` method. The ``registration.html.twig``
template might look something like this:

.. code-block:: html+jinja

{# app/Resources/views/Emails/registration.html.twig #}
<h3>You did it! You registered!</h3>

{# example, assuming you have a route named "login" $}
To login, go to: <a href="{{ url('login') }}">...</a>.

Thanks!

{# Makes an absolute URL to the /images/logo.png file #}
<img src="{{ absolute_url(asset('images/logo.png')) }}"

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

0 comments on commit 78733c3

Please sign in to comment.