Skip to content

Better explain the most common problems when testing emails #7115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
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
22 changes: 18 additions & 4 deletions email/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ Start with an easy controller action that sends an email::
return $this->render(...);
}

.. note::

Don't forget to enable the profiler as explained in :doc:`/testing/profiling`.

In your functional test, use the ``swiftmailer`` collector on the profiler
to get information about the messages sent on the previous request::

Expand Down Expand Up @@ -67,4 +63,22 @@ to get information about the messages sent on the previous request::
}
}

Troubleshooting
---------------

Problem: The collector object is ``null``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The email collector is only available when the profiler is enabled and collects
information, as explained in :doc:`/testing/profiling`.

Problem: The collector doesn't contain the email
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If a redirection is performed after sending the email (for example when you send
an email after a form is processed and before redirecting to another page), make
sure that the test client doesn't follow the redirects, as explained in
:doc:`/testing`. Otherwise, the collector will contain the information of the
redirected page and the email won't be accessible.

.. _`Swift Mailer`: http://swiftmailer.org/