ContactController.php
This handles the sending of a user's contact information to the Mapmama email.
sendContact
sendContactpublic function sendContact(Request $request)
{
// Subject for the contact email
$subject = "Someone contacted us!";
// Compose the body of the email using form input values
$body = "
<div style='display:block'>Name: " . $request->input('name') . "</div>
<div style='display:block'>Phone Number: " . $request->input('phone') . "</div>
<div style='display:block'>Email: " . $request->input('email') . "</div>
<div style='display:block'>Message: " . $request->input('message') . "</div>
";
// Use Laravel Mail facade to send an email using the EmailContent Mailable
Mail::to('[email protected]')->send(new EmailContent($subject, $body));
// Response indicating success
$response = [
'SUCCESS' => 1,
];
// Return the response
return $response;
}Last updated