To achieve the functionality you're looking for, you can use a combination of Laravel's built-in features and some additional packages. While there might not be a single plugin that does everything out-of-the-box with a UI, you can piece together a solution using Laravel's scheduling, notifications, and possibly a package like Spatie's Mailcoach for more advanced email marketing features.
Here's a step-by-step approach:
-
User Query for Inactivity: Use Eloquent to query users who haven't logged in for the last 3 months.
use App\Models\User; use Carbon\Carbon; $inactiveUsers = User::where('last_login_at', '<', Carbon::now()->subMonths(3))->get(); -
Send Emails: Use Laravel's Mailable to send emails to these users.
use Illuminate\Support\Facades\Mail; use App\Mail\InactivityReminder; foreach ($inactiveUsers as $user) { Mail::to($user->email)->send(new InactivityReminder($user)); } -
Track Email Opens: To track if a user has opened an email, you can use a package like Laravel Mail Tracker or integrate with a service that provides open tracking.
-
Schedule Follow-up Emails: Use Laravel's task scheduling to send follow-up emails if the user hasn't opened the email within a week.
// In App\Console\Kernel.php protected function schedule(Schedule $schedule) { $schedule->call(function () { $users = User::where('last_login_at', '<', Carbon::now()->subMonths(3)) ->whereDoesntHave('emailOpens', function ($query) { $query->where('created_at', '>', Carbon::now()->subWeek()); })->get(); foreach ($users as $user) { Mail::to($user->email)->send(new FollowUpReminder($user)); } })->weekly(); } -
UI for Managing Emails: While there isn't a direct UI for managing transactional emails in Laravel, you can build a simple admin panel using Laravel Filament or Nova to manage and view email campaigns, user activity, and more.
-
Consider Spatie Mailcoach: If you need more advanced features like detailed analytics, segmentation, and automation, Spatie Mailcoach is a great option. It does require some setup, but it provides a robust platform for email marketing.
By combining these tools and techniques, you can create a system that sends transactional emails based on user activity and follows up as needed. While it requires some coding, it gives you the flexibility to customize the logic to fit your specific needs.