Laravel 4 send an email from localhost to gmail

I cannot send an email from my locally developed site. In my controller, I have the following code:

public function store()
{
    $data = Input::all();

    Mail::send('contact.display',$data, function($message)
    {
        $message->to('giannhs905@gmail.com')->subject('Welcome!');
    });
}

And my view is below:

<h1>    
Subject : {{$data['subject']}}
</h1>   

<h1>
From : {{ $data['name'] }}
</h1>
<br/><br/>

{{ $data['comments'] }}

Initially, I don't care about the inputs given in my form. I just want to send a fictitious email address to my account ...

What am I doing wrong? Do I have to change any configuration. files? ..

+4
source share
1 answer

Check the file config/mail.php.

If you have a gmail account, you can use the googles mail driver. Use it like this:

'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'encryption' => 'ssl',
'username' => '*your@gmail.com*',
'password' => '*yourpassword*',
+14
source

All Articles