I\'m currently trying to create a HTML email in Laravel 5 and I have some text (which contains
elements) I want to insert in the email. I use the fo
After checking various solutions, following codes worked for me -
try {
$template_data = ['otp' => $otp, 'name' => $name];
//send verification code
Mail::send(['html' => 'email.account_verification'], $template_data,
function ($message) use ($email) {
$message->to($email)
->from('test@yourdamin.com') //not sure why I have to add this
->subject('Account verification');
});
return Response::json(['code' => 200, 'msg' => 'Sent successfully']);
} catch (Exception $ex) {
return Response::json(['code' => 200, 'msg' => 'Something went wrong, please try later.']);
}