All frameworks

Send Email from Laravel

Send emails from Laravel controllers and jobs

1

Install the SDK

composer require sendpigeon/sendpigeon
2

Set your API key

SENDPIGEON_API_KEY=your_api_key_here

Get your API key from the dashboard.

3

Send your first email

php
<?php
// app/Http/Controllers/ContactController.php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use SendPigeon\SendPigeon;

class ContactController extends Controller
{
    public function store(Request $request)
    {
        $validated = $request->validate([
            'email' => 'required|email',
            'name' => 'required|string',
        ]);

        $client = new SendPigeon(config('services.sendpigeon.key'));

        $client->send(
            to: $validated['email'],
            from: 'hello@yourdomain.com',
            subject: "Thanks for reaching out, {$validated['name']}!",
            html: '<h1>We got your message</h1><p>We\'ll get back to you soon.</p>',
        );

        return response()->json(['success' => true]);
    }
}

Why use SendPigeon with Laravel?

  • Works with Laravel queues
  • Notification channel support
  • Blade template integration
  • 99.9% deliverability with dedicated IPs
  • Real-time analytics and webhook events
🧪

Testing locally? Use our local email server to catch emails without sending real ones.

🎨

Prefer visual editing? Build email templates with our free drag-and-drop builder. Learn more →

Ready to send emails from Laravel?

Start free with 3,000 emails/month. No credit card required.

Get Started Free

Other php frameworks