Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

npboy's avatar
Level 1

php form in laravel project.

1st part:

Mail::send('emails.reservation-mail',$data,function ($message) use ($data){ $message->from($data['from']); $message->to($data['email']); $message->subject($data['subject']); }); 2nd part:

Mail::send('emails.booking-mail',$data,function ($message) use ($data){ $message->from($data['email']); $message->to($data['from']); $message->subject('Thank You For Booking. '.SITE_META_TITLE); }); I am using the above code in our website. 1st part doesn't work but 2nd part is working in the same form.

I want to recieve the user's filled data in our mailbox. Only 2nd part message goes to users but didn't recieve the user's data in our mailbox.

Even i use my email address manually: $message->to($data['[email protected]']); still doesn't recieve any data in the mail.

0 likes
1 reply
Tray2's avatar

Hard to know what you have done here, however I can give you two tips.

  1. Wrap any code blocks in three back ticks. <code>
  2. Read the docs on mail here https://laravel.com/docs/12.x/mail

If you do number 1, then your code will be readable.

Mail::send('emails.reservation-mail', $data, function ($message) use ($data)
{
  $message->from($data['from']); 
  $message->to($data['email']); 
  $message->subject($data['subject']);
 });

Please or to participate in this conversation.