0

I'm trying to make the laravel default "forget password" to work, after a long try of setting up, I finally got the email sent. Cheers! but I have a question now, the sender email address is not what I set. I want the from address to be my gmail address but when I received the email, the from address is "myusername@server214.web-hosting.com". Any hint, what is wrong?

in my mail.php:

'driver' => 'sendmail',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => ['address' => "myemail@gmail.com", 'name' => "myname"],
'encryption' => 'tls',
'username' => 'myemail@gmail.com',
'password' => 'password',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
jcy
  • 1
  • 1
  • 8

1 Answers1

0

You are using the send mail driver so your Gmail account isn't use

Use the SMTP driver instead

https://laravel.com/docs/5.2/mail

Sylwit
  • 1,497
  • 1
  • 11
  • 20
  • i get errors when i change to "smtp" Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [Network is unreachable #101] in StreamBuffer.php line 269 at Swift_Transport_StreamBuffer->_establishSocketConnection() in StreamBuffer.php line 62 at Swift_Transport_StreamBuffer->initialize(array('protocol' => 'tcp', 'host' => 'smtp.gmail.com', 'port' => '587', 'timeout' => '30', 'blocking' => '1', 'tls' => true, 'type' => '1', 'stream_context_options' => array())) in AbstractSmtpTransport.php line 113 – jcy Aug 26 '16 at 03:52
  • Now the problem is in the configuration but the driver is correct. you can check this link http://stackoverflow.com/questions/32515245/how-to-to-send-mail-using-gmail-in-laravel-5-1 – Sylwit Aug 26 '16 at 04:03
  • no luck with the link u gave. I tried to change the host, from, username, password to my own domain email address info, it works perfectly, but fail with gmail. whats wrong with the gmail? – jcy Aug 26 '16 at 07:00
  • You have to enable Gmail less secure app https://support.google.com/a/answer/6260879?hl=en or check how to configure your Gmail account but now it's not related to laravel – Sylwit Aug 26 '16 at 11:06