Issue using Mailable and markdowns

Posted 10 months ago by deladels

i am trying to send an email when a users books a schedule. (i want to use the simple way so this is triggered when a button is clicked)


    public function email(Request $request, $bookingId){

        $booking = Booking::find($bookingId);

        Mail::to($request->email)->send(new ScheduleBooked($booking));

        return redirect('uschedules');

ScheduleBooked.php (Mailable)


namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Booking;

class ScheduleBooked extends Mailable
    use Queueable, SerializesModels;

    public $booking;

    public function __construct(Booking $booking)
        $this->booking = $booking;

    public function build()
        return $this->markdown('emails.schedules.booked')->with([

                        'lastname'  => $this->booking->lastName,
                        'firstname' => $this->booking->firstName,

route file.

Route::get('/email', '[email protected]')->name('sendEmail');

i don't get any errors but the emails aren't being sent to my mailtrap.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.