Skip to content
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
18 changes: 18 additions & 0 deletions email/spool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,21 @@ You can also set the time limit in seconds:
Of course you will not want to run this manually in reality. Instead, the
console command should be triggered by a cron job or scheduled task and run
at a regular interval.

.. caution::

When you create a message with SwiftMailer, it generates a ``Swift_Message``
class. If the ``swiftmailer`` service is lazy loaded, it generates instead a
proxy class named ``Swift_Message_<someRandomCharacters>``.

If you use the memory spool, this change is transparent and has no impact.
But when using the filesystem spool, the message class is serialized in
a file with the randomized class name. The problem is that this random
class name changes on every cache clear. So if you send a mail and then you
clear the cache, the message will not be unserializable.

On the next execution of ``swiftmailer:spool:send`` an error will raise because
the class ``Swift_Message_<someRandomCharacters>`` doesn't exist (anymore).

The solutions are either to use the memory spool or to load the
``swiftmailer`` service without ``lazy`` option (see :doc:`/service_container/lazy_services`).