On the SitePoint PHP blog there's a new tutorial posted by Younes Rafie looking at logging of mail handling in Laravel by extending the already included driver with your own updates.
One of the many goodies Laravel offers is mailing. You can easily configure and send emails through multiple popular services, and it even includes a logging helper for development.
[...] Laravel also provides a good starting point for sending mails during the development phase using the log driver, and in production using smtp, sparkpost, mailgun, etc. This seems fine in most cases, but it can’t cover all the available services! In this tutorial, we’re going to learn how to extend the existing mail driver system to add our own.
They start by helping you create the service provider used to log the mail information to a database table (the
DBMailProvider). The extend the existing mail provider class and set it up to register the Swift Mailer provider if the configuration for the mailer is not set to "db". The the tutorial shows how to update the provider to override the
swift.mailer instance in the application dependency injection container and include the code to override the "send" method. A migration is created to hold the mail data and a matching
Emails model is used to save the mail results.