Level 34
@mariam528 you can render a blade file and put it in the mailer body like
$mail= new PHPMailer\PHPMailer();
// other configuration
$mail->IsHTML(true);
$mail->Body = view('email')->render();
$mail->Send()
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
hello i am using php mailer to send mails in laravel. i need to include view file in body of php mailer and often need to pass data to view of emails. perhaps anybody know how to include view file in body of php mailer?
@mariam528 then pass it like usual?
$mail= new PHPMailer\PHPMailer();
// other configuration
$mail->IsHTML(true);
$mail->Body = view('email', ['data' => 'sample'])->render();
$mail->Send()
Please or to participate in this conversation.