Description
Hello,
I would like to have a "file" transport for Symfony Mailer.
It would write messages to a configurable folder, as serialized files (using PHP --serialize
).
The main use case I see if for testing: when testing a Symfony application through Behat/Selenium or Symfony Panther, you can't access the kernel or the profiler[^1].
Such files could easily be counted and read, it would offer a good DX for a popular use case (previously in documentation).
Other use cases I see would be for spooling and log/backups, someone may want a copy of every email sent. Symfony Messenger is a better solutions for those use case, but I could imagine scenario when it is not available.
RFS, DSN would be something like this:
file://var/mail
for a path relative to project dir
file:///tmp/mail
for absolute path
Files would be named randomly (or should it be configurable?).
Right now I'm implementing this in a work project, later I could extract the code & open a corresponding PR.
^1: technically, I could enable and access profiler UI, but it feels hacky - plus there are some performances downside