Mahmoud Al-HabashOpen to new projects
  • WorkWork
  • ServicesServices
  • LabLab
  • WritingWriting
  • ContactContact
Amman--:--عربي
Writing/Laravel

Laravel Mail: Sending Emails

Send beautiful emails with Laravel Mail and Mailables.

16 January 20261 min readLaravelاقرأ بالعربية

On this page

  1. Create Mailable
  2. Mailable Class
  3. Send Email
  4. With Attachments

Send emails with Laravel:

Create Mailable

php artisan make:mail WelcomeEmail

Mailable Class

class WelcomeEmail extends Mailable
{
    public function __construct(public User $user) {}

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

Send Email

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

With Attachments

php
public function attachments(): array
{
    return [
        Attachment::fromPath('/path/to/file.pdf'),
    ];
}
All articles

Keep reading

  • Laravel Action Classes Pattern16 January 20261 min read
  • Laravel Action Classes: Single Responsibility16 January 20261 min read
  • Laravel API Rate Limiting16 January 20261 min read