How7oHow7o
  • Home
  • Tools
    • All Tools
    • Image Tools
    • Text & String Tools
    • Video Tools
    • Developer Tools
    • PDF Tools
    • Calculators & More
  • Prank Screens
  • Learn
  • Blog
  • Contact
Reading: How to Send a Simple Email in Laravel (Fast SMTP + Mail::raw)
Share
Notification Show More
Font ResizerAa
How7oHow7o
Font ResizerAa
  • OS
Search
  • Home
  • Tools
    • All Tools
    • Image Tools
    • Text & String Tools
    • Video Tools
    • Developer Tools
    • PDF Tools
    • Calculators & More
  • Prank Screens
  • Learn
  • Blog
  • Contact
Follow US
© 2024–2026 How7o. All rights reserved.
How7o > Free Laravel, PHP, WordPress & Server Tutorials > Web Development > How to Send a Simple Email in Laravel (Fast SMTP + Mail::raw)
Web Development

How to Send a Simple Email in Laravel (Fast SMTP + Mail::raw)

how7o
By how7o
Last updated: January 12, 2026
4 Min Read
Send a simple email in Laravel using Mail::raw and SMTP
SHARE

I needed to send a “quick test email” from a Laravel project the other day. Nothing fancy—no templates, no queues, no markdown mail. Just a simple message to confirm my server could actually deliver emails.

Contents
  • What you need before sending email
  • Step 1: Configure SMTP in your Laravel .env file
  • Step 2: Send a simple email with Mail::raw()
  • Step 3 (recommended): Use a Mailable (cleaner for real projects)
  • Common errors (and how I fix them fast)
    • 1) “Connection could not be established…”
    • 2) Emails “send” but never arrive
    • 3) I changed .env but Laravel still uses old values
  • Helpful links
  • Final thoughts

But like always, the “simple” part depends on one thing: mail configuration. Laravel can send emails easily, but only after you set up SMTP in .env. Once I did that, sending the email was literally a few lines with Mail::raw().

In this guide, I’ll show you the easiest way to send a simple email in Laravel (the exact approach I use for quick testing), plus a cleaner “best practice” version using a Mailable if you decide to expand later.

What you need before sending email

  • A working Laravel project
  • SMTP credentials (Mailtrap / Gmail SMTP / SendGrid / any provider)
  • Access to edit your .env file

Step 1: Configure SMTP in your Laravel .env file

This is the part most beginners skip. Laravel won’t magically send email until you tell it which mail server to use. For testing, Mailtrap is great because it captures messages safely instead of sending them to real inboxes.

Open your .env file and add/update these values (example using Mailtrap SMTP):

MAIL_MAILER=smtp
MAIL_HOST=live.smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=<smtpuser>
MAIL_PASSWORD=<password>
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="Test User"

Important: after editing .env, clear config cache (especially on production servers where config is cached):

php artisan config:clear

If your app uses cached config in production, you can re-cache after:

php artisan config:cache

Step 2: Send a simple email with Mail::raw()

For the fastest test, I usually create a temporary route. Open routes/web.php and add this:

use Illuminate\Support\Facades\Mail;

Route::get('/test-email', function () {
    try {
        Mail::raw('This is a simple test email.', function ($message) {
            $message->to('[email protected]')
                    ->subject('Test Email');
        });

        return "Email Sent!";
    } catch (\Exception $e) {
        return $e->getMessage();
    }
});

Now visit:

https://your-domain.com/test-email

If you’re using Mailtrap, check your inbox in Mailtrap and you should see the message there.

Step 3 (recommended): Use a Mailable (cleaner for real projects)

Mail::raw() is perfect for quick testing, but if you’re building a real feature (welcome email, password reset notice, etc.), a Mailable keeps things clean.

Create a Mailable:

php artisan make:mail SimpleTestMail

Open the generated file (usually app/Mail/SimpleTestMail.php) and keep it super simple:

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class SimpleTestMail extends Mailable
{
    use Queueable, SerializesModels;

    public function build()
    {
        return $this->subject('Test Email')
                    ->text('emails.simple-test');
    }
}

Create the plain text view:

// resources/views/emails/simple-test.blade.php
This is a simple test email from Laravel.

Send it from your route/controller:

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

Mail::to('[email protected]')->send(new SimpleTestMail());

Common errors (and how I fix them fast)

1) “Connection could not be established…”

  • Double-check MAIL_HOST and MAIL_PORT
  • Try switching encryption: tls (587) vs ssl (465)
  • Some VPS providers block outbound SMTP ports—Mailtrap usually works, but if not, ask your host or use an email API provider

2) Emails “send” but never arrive

  • For testing, use Mailtrap so you can verify delivery instantly
  • Make sure MAIL_FROM_ADDRESS is allowed by your SMTP provider

3) I changed .env but Laravel still uses old values

This is almost always config caching. Run:

php artisan config:clear

Helpful links

  • Laravel Mail documentation
  • Mailtrap (safe email testing)
  • Display only the current date in Laravel using Carbon

Final thoughts

If your goal is just to verify “can my Laravel app send email?”, Mail::raw() + SMTP config is the fastest path. Once it works, you can upgrade to a Mailable for cleaner code and reusable templates.

TAGGED:DebuggingEmailLaravelMail ConfigMail::rawMailableMailtrapphpSMTP

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article How to force quit frozen apps in Ubuntu Force Close an App in Ubuntu (xkill, System Monitor, kill -9)
Next Article Display only the current date in Laravel using Carbon How to Display Only the Current Date in Laravel (Carbon Examples)
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

You Might Also Like

Deleting a Laravel user cascades to remove related posts, photos, and notifications
Web Development

How to Delete Related Records in Laravel Eloquent

6 Min Read
Laravel Eloquent records today — Carbon today helper and whereDate illustration
Web Development

How to Get Records Created Today in Laravel

6 Min Read
Laravel nullable exists validation — nullable, sometimes, and present rule combinations
Web Development

Laravel Nullable Exists Validation (nullable, sometimes, present)

9 Min Read
Debug PHP like console.log using error_log and server logs
Web Development

How to Debug in PHP Like console.log (echo, error_log, WordPress debug.log)

6 Min Read
How7oHow7o

Free browser-based tools, prank screens, and step-by-step tech tutorials. No signup, nothing uploaded.

  • Private by design — your files never leave your device
  • Instant — no signup, no install, no waiting
  • Always free — no trials, no watermarks, no paywalls

Tools

  • PDF Editor
  • Image Upscaler
  • JPEG Compressor
  • Password Generator
  • QR Code Generator
  • Video Trimmer
  • See all tools →

Pranks

  • Cracked Screen Prank
  • Fake Blue Screen (BSOD)
  • Fake Disk Format
  • Fake Low Battery
  • Fake Virus Scan
  • Fake Windows 10 Update
  • See all prank screens →

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service
  • Sitemap
© 2024–2026 How7o. All rights reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?