Issue with Laravel Mailgun Email Content

I’m encountering an issue with Laravel Mailgun where emails include extra page details. How can I send only the intended message?

Route::post('/feedback', 'NotifyController@handle');

public function handle(Request $req) {
   $text = $req->input('msg');
   Mail::send('emails.alert', ['body' => $text], function($mailer) {
       $mailer->from('[email protected]', 'System');
       $mailer->to('[email protected]')->subject('New Message');
   });
}

I experienced a similar issue when trying to send emails from my Laravel application. It turned out that an unintended layout or including partials in the view rendered additional content that was not part of the intended message. I resolved it by creating a dedicated, minimal email view that contained only the variable content. Double-check that the blade template doesn’t extend a layout or include other redundant elements. I also verified that your Mailgun configuration isn’t adding extra wrapping details to your messages. This approach helped me ensure that only the message content was sent without any extra details.

hey, try using a plain view without any layout settings. sometimes laravel or mailgun may append default styling if a layout exists. check any global settings or middleware that might add extra info too. might help to isolate the problem by testing with a simple text-only template.