🔴 Laravel
Beginner
What is a Mailable in Laravel?
Answer
A Mailable is a class representing an email message in Laravel. Generate: php artisan make:mail WelcomeEmail. The class defines the email content using the fluent envelope() and content() methods (Laravel 9+): public function envelope(): Envelope { return new Envelope(subject: "Welcome!"); } and public function content(): Content { return new Content(view: "emails.welcome"); }. Pass data to the view through constructor properties. Send synchronously: Mail::to($user)->send(new WelcomeEmail($user)). Send to queue: Mail::to($user)->queue(new WelcomeEmail($user)). Preview in browser by returning the Mailable from a route. Configure mail drivers in config/mail.php: SMTP, Mailgun, Postmark, Amazon SES, or Sendmail.