Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4 send email from localhost to gmail

I am unable to 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('[email protected]')->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 Inputs given in my form..I just want to send a dummy email to my account...

What am I doing wrong? Should I change some config. files..?

like image 322
John Avatar asked Dec 08 '22 10:12

John


1 Answers

Check your config/mail.php file.

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

'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'encryption' => 'ssl',
'username' => '*[email protected]*',
'password' => '*yourpassword*',
like image 145
Maurice Avatar answered Dec 11 '22 09:12

Maurice