Prompt

How do I send emails from a Laravel app?

Technology / Api platforms6 observationsLast seen Oct 7, 2026

Latest observation

Oct 7, 2026ChatGPTWeb search: on

Laravel has a built-in mail system powered by Symfony Mailer. The typical flow is:

Configure a mail provider → create a Mailable → send it with Mail::to() → optionally queue it. Laravel supports SMTP and providers such as Postmark, Mailgun, Resend, and Amazon SES. Laravel

1. Configure your mail provider

For example, using SMTP, put the credentials in .env:

MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=your-username
MAIL_PASSWORD=your-password
MAIL_ENCRYPTION=tls

MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

The exact host, port, username, and password depend on your email provider.

Laravel reads the mail configuration from config/mail.php. Laravel

2. Create a Mailable

Run:

php artisan make:mail WelcomeEmail

Then define the email:

<?php

namespace App\Mail;

use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;

class WelcomeEmail extends Mailable
{
    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Welcome to our app!',
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.welcome',
        );
    }
}

3. Create the email view

Create:

resources/views/emails/welcome.blade.php

<h1>Welcome!</h1>

<p>Thanks for creating an account with us.</p>

4. Send it

For example, from a controller:

use App\Mail\WelcomeEmail;
use Illuminate\Support\Facades\Mail;

Mail::to($user->email)->send(new WelcomeEmail);

You can also add CC/BCC:

Mail::to($user->email)
    ->cc('admin@example.com')
    ->bcc('audit@example.com')
    ->send(new WelcomeEmail);

This is the standard Laravel Mailable API. Laravel

5. Prefer queues for production

Email sending can slow down an HTTP request, so for transactional emails it's usually better to queue them:

Mail::to($user->email)
    ->queue(new WelcomeEmail);

Laravel's queue system then sends the email in the background. Laravel+1

You'll need a queue worker running, for example:

php artisan queue:work

For production, you would normally run that worker under a process manager rather than manually in a terminal.

A good production setup

I'd generally use:

Laravel application
       │
       ├── Mailable
       │
       ▼
     Queue
       │
       ▼
 Queue worker
       │
       ▼
Email provider
       │
       ▼
   Recipient

This keeps your web requests fast and lets you retry failed email jobs. Laravel supports multiple queue backends, including database, Redis, and Amazon SQS. Laravel

Official docs: Laravel Mail documentation

If you tell me which email provider you want to use (Gmail, Microsoft 365, Mailgun, Resend, Amazon SES, Postmark, etc.), I can give you the exact .env configuration and Laravel code.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (6 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.