How7o
  • Home
  • Marketing
    MarketingShow More
    The Beginner’s Guide about Facebook Advertising
    6 Min Read
    64 Creative Marketing Ideas to Boost Your Business
    6 Min Read
  • Resouce
    ResouceShow More
    5 Must-Have Digital Marketing Data Sources
    6 Min Read
    Archival Solution Deployment Best Practices
    6 Min Read
    How Secure Your Mobile Device in Six Steps
    6 Min Read
    5 Effective Ways to Increase Market Share Online
    6 Min Read
    Tips Debugging with CMS code Optimization Quick
    6 Min Read
  • Features
    FeaturesShow More
    7 Things You Need to Know About Feature Driven
    6 Min Read
    Turn an Excel Spreadsheet or Google Sheets Doc
    6 Min Read
    3 Common Ways to Forecast Currency Exchange
    6 Min Read
    Step by Step Guide to a Technical SEO Audit
    6 Min Read
    10+ Free Tools to Make Your Own Animated GIFs
    6 Min Read
  • Guide
    GuideShow More
    Create an Engagement Custom Audience from Video
    6 Min Read
    The Ultimate Guide, Easily Make Videos Tutorials
    6 Min Read
    Tips to Keep Your Cloud Storage Safe and Secure
    6 Min Read
  • Contact
  • Blog
Reading: How to Send a Simple Email in Laravel (Fast SMTP + Mail::raw)
Share
Subscribe Now
How7oHow7o
Font ResizerAa
  • Marketing
  • Resouce
  • Features
  • Guide
  • Complaint
  • Advertise
Search
  • Categories
    • Marketing
    • Resouce
    • Features
    • Guide
    • Lifestyle
    • Wellness
    • Healthy
    • Nutrition
  • More Foxiz
    • Blog Index
    • Complaint
    • Sitemap
    • Advertise
Follow US
Copyright © 2014-2023 Ruby Theme Ltd. All Rights Reserved.
How7o > Blog > 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.
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 5 Must-Have Digital Marketing Data Sources
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

Your email address will not be published. Required fields are marked *

FacebookLike
XFollow
PinterestPin
InstagramFollow

Subscribe Now

Subscribe to our newsletter to get our newest articles instantly!
Most Popular
How I Fixed Composer Dependency Errors
How I Fixed Composer Dependency Errors Using the –ignore-platform-reqs Flag (Step-by-Step Guide)
January 12, 2026
Transfer Discourse to a new server
How to Transfer Discourse to a New Server on AlmaLinux (Backup + Restore, Step-by-Step)
January 12, 2026
Installed Discourse on AlmaLinux
How I Installed Discourse on AlmaLinux (Docker Method, Step-by-Step)
January 12, 2026
Installing Docker on AlmaLinux guide
Install Docker on AlmaLinux: Step-by-Step (Docker CE + Compose)
January 12, 2026
Change welcome message on Ubuntu VPS server (MOTD + SSH banner)
Change Welcome Message on Ubuntu VPS (MOTD + SSH Banner)
January 12, 2026

You Might Also Like

Laravel Blade Time Format (HH:MM)
Web Development

How to Show Only Hours and Minutes in Laravel Blade (HH:MM)

3 Min Read
Display only the current date in Laravel using Carbon
Web Development

How to Display Only the Current Date in Laravel (Carbon Examples)

4 Min Read
Check if GD library is installed in PHP (phpinfo and extension_loaded)
Web Development

How to Check if GD Library Is Installed in PHP (3 Easy Methods)

5 Min Read

Always Stay Up to Date

Subscribe to our newsletter to get our newest articles instantly!
How7o

We provide tips, tricks, and advice for improving websites and doing better search.

Latest News

  • SEO Audit Tool
  • Client ReferralsNew
  • Execution of SEO
  • Reporting Tool

Resouce

  • Google Search Console
  • Google Keyword Planner
  • Google OptimiseHot
  • SEO Spider

Get the Top 10 in Search!

Looking for a trustworthy service to optimize the company website?
Request a Quote
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?