Freek Van der Herten has posted a guide to sending an email in a Larvel Spark-based system to remind a user that their trial of a service is expiring soon. In this case, it217;s a monitoring service he offers called Oh Deal.
I’m currently building a webapp named Oh Dear: an easy to use and beautiful website monitor. […] Oh Dear is built on top Laravel Spark, a Laravel based template to kick off SaaS projects. It offers logic for organising users into teams, handles trial periods, subscriptions, payments, invoices and much more.
[…] Unfortunately, Spark will not send out a mail to team owners whose teams are in trial periods that will soon expire. Luckily it’s easy to add that yourself. I’ll show you how to do just that in this post. Along the way, you’ll learn some good general tips for sending out emails in batches. Let’s get started!
He then starts in on the code, showing first how to locate the teams that should be sent the email. He adds a new field to track when the email was sent and the code required to send the actual email. He shows how to make the command restartable, create the "Mailable" class and the command to send the actual email.