How can i change the Mail Subject, Title and the senders name from the form input fields,
Here's my contact form
<h1>Contact</h1>
<form action="contact/store" method="post">
@csrf
<label>Name</label>
<input type="text" name="name" placeholder="Name">
<br>
<label>Email</label>
<input type="email" name="email" placeholder="Email">
<br>
<label>Message</label>
<textarea name="message" cols="30" rows="10"></textarea>
<button type="submit">Submit</button>
</form>
Here's my Mail controller
public function store(Request $request)
{
$name = $request->name;
$email = $request->email;
$textmessage = $request->message;
$data = array('name' => $name, 'email' => $email, 'textmessage' => $textmessage);
Mail::send('mail', $data, function ($message) {
$message->to('jareerzeenam.29@gmail.com', 'Email Title')->subject('Test Subject 2');
$message->from('test@gmail.com', 'Test Name 2');
});
echo "HTML Email Sent. Check your inbox.";
}
Here's my mail.blade.php
<h1>Hi, i'm </h1>
<p>Email :</p>
<p>Message : </p>
Here's how i get the email as
How can i get the name from the contact form input field to my email instead of the static name i have given in the controller, hope my question is understandable.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/31rL8Sl
via IFTTT
Aucun commentaire:
Enregistrer un commentaire