I have implemented contact form in my laravel project using 'smtp.gmail.com' host. I have used this tutorial to build contact form: http://dixitpatel.com/form-in-laravel-with-email-function/ My problem is that when I receive mail the 'from' and 'to' field has same email that I have set into 'to' field instead of form posted email for 'from' field.
My code is here:
Mail::send('emails.hello', $data, function($message) use ($data)
{
$message->from($data['email'] , $data['first_name']);
$message->to('mymail@gmail.com', 'Amy')->subject('Contact Request');
});
Here $data is input form filed array.
try inside of app/config/mail.php
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => array('address' => 'application@whatever.com', 'name' => '<Name of Sender >'),
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community