hjortur17
5 months ago
353
5
Laravel

Need help sending email

Posted 5 months ago by hjortur17

Hi, I'm trying to send an email to myself through my website but I'm struggling using Laravel Mail. I can't figure out how to access the data correctly in the Mail function and then in the email blade file. Can somebody please explain it for me :)

Mail::send('emails.form', $request, function ($message) {
	$message->from($request->email, $request->name);

	$message
		>to(env("MAIL_TO_ADDRESS"))
		->subject($request->subject);
});
<!DOCTYPE html>
<html>
<head>
	<link href="https://fonts.googleapis.com/css2?family=Poppins:[email protected];600&display=swap" rel="stylesheet">
</head>
<body>
	<h1>{{ $form->subject}}</h1>
	<p>{{ $form->content }}</p>
</body>
</html>

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