TechStore Explorer sends two transactional emails triggered by wishlist actions — both delivered asynchronously via Laravel’s queue system using Mailtrap Sandbox SMTP in development. Because both mail classes implementDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Emmanuel-Mtz-777/TechStore-Explorer/llms.txt
Use this file to discover all available pages before exploring further.
ShouldQueue, dispatch returns immediately and the HTTP response is never delayed by mail delivery; a separate queue worker picks up and processes each job in the background.
Email Events
TwoMailable classes handle wishlist notifications, each rendering its own Blade view:
WishlistAddedMail
Sent when a user adds a product to their wishlist. The mail receives the product as a constructor argument and passes it to its template, which displays the product price.
- Subject:
Producto añadido a favoritos - View:
emails.wishlist-added - Template content: confirms the addition and displays the product price (
$product['price'])
WishlistDeletedMail
Sent when a user removes a product from their wishlist.
- Subject:
Producto Eliminado de favoritos - View:
emails.wishlist-deleted - Template content: confirms the removal and encourages the user to continue browsing
How Queuing Works
Emails are not sent inline — they are pushed onto the queue withMail::to(...)->queue(...) inside the web WishlistController. The dispatched job is serialized and stored as a row in the jobs database table. The queue worker process (php artisan queue:work) polls that table continuously and sends each email when its turn arrives.
This means two processes must be running simultaneously for email delivery to work:
- The Laravel web server — handles HTTP requests and enqueues mail jobs
- The queue worker — dequeues and dispatches the actual emails via SMTP
Setting Up Mailtrap
Create a free Mailtrap account
Go to mailtrap.io and sign up for a free account. No credit card is required for the Sandbox plan, which is sufficient for development and testing.
Open Email Testing → Inboxes
After logging in, navigate to Email Testing → Inboxes in the left sidebar. Select an existing sandbox inbox or create a new one specifically for TechStore Explorer.
Copy your SMTP credentials
Inside the inbox, click Show Credentials (or select the SMTP integration tab). Copy the Username and Password values — you will need these in the next step.
Update your .env file
Open your project’s Replace
.env file and replace the mail block with your Mailtrap credentials:your_username and your_password with the values copied from the Mailtrap dashboard.Start the queue worker
In a separate terminal, start the queue worker so it can process email jobs as they arrive:Keep this terminal open for as long as you are testing email functionality. The worker will log each processed job to the console.
Environment Variables Reference
The complete mail configuration block for your.env file:
Queue Driver Note
The defaultQUEUE_CONNECTION=database (set in .env.example) stores all pending jobs in the MySQL jobs table. This requires no additional infrastructure beyond the database already used by the application.
During testing you can switch to the sync driver, which executes mail jobs inline and synchronously — no worker process is needed:
sync blocks the HTTP response until the SMTP transaction completes. It is convenient for quick verification but should not be used in production or for any endpoint where response time matters.