Email Configration Laravel - laravel

Hello guys I'm new to laravel. I'm trying to send a email but I can't understand how to configure it. I was looking at their email configuration and they were setting it up for mailgun etc. I don't want to set it up for any service. and if I have to is there any free service that can help me. Can somebody please explain to me how can I do that and I'm using Laravel 5.2

You can use any free service, like Gmail or Sendgrid, for example.
Just fill settings in .env file to make it work:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=yourEmail
MAIL_PASSWORD=yourPassword
MAIL_ENCRYPTION=tls

Related

What's the best solution for my laravel project to send "forgotten password" emails?

I'm in the middle of deploying my project, and the last part is getting the "forgotten password" system to work. Currently, without any mail configuration, I get the error
Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required "
I have bought my domain through namecheap.com and hosting on digitalocean.com.
My .env mail config currently looks like this
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
, which obviously isn't supposed to work.
Where do I go to get a mail username and password? Thanks.
I ended up going with mailgun's free option for now. It seems to work fine so far!

Is it possible to send email using configuration from another shared hosting?

My Laravel Apps cannot send email using another shared hosting configuration.
I'm developing laravel app (Laravel 5.7), one of my apps function is to send email after register new account. I have deployed my apps to my VPS and I have account on a shared hosting. I used my shared hosting configuration for sending email and I have added the config to my .env file, like
MAIL_DRIVER=smtp
MAIL_HOST=mail.embara.id
MAIL_PORT=465
MAIL_USERNAME="username"
MAIL_PASSWORD="password"
MAIL_FROM_ADDRESS="FROM"
MAIL_FROM_NAME="FROM NAME"
MAIL_ENCRYPTION=null
but nothing happen, only failed (I am using queue, and i have tested using mailtrap.io, everything works fine)
Anyone knows what is wrong with my config?
Thanks
Think you need ssl, try this:
MAIL_DRIVER=smtp
MAIL_HOST=mail.embara.id
MAIL_PORT=465
MAIL_USERNAME=noreply#embara.id # <-- full email address
MAIL_PASSWORD=secret
MAIL_ENCRYPTION=ssl # <-- This

HostGator, Laravel and Email

I am configuring my Laravel app to send a welcome email, just like Jeffrey Way said at Laracasts and it works fine in Mailtrap. But when I change to HostGator, which I will use in real world, it just not work at all!
Here's some code:
MAIL_DRIVER=sendmail
MAIL_HOST=srv218.prodns.com.br
MAIL_PORT=465
MAIL_USERNAME=automatico#cepcar.com.br
MAIL_PASSWORD=******* <- obviously hidden
MAIL_ENCRYPTION=tls
Have changed the driver to SMTP, encryption to SSL, none but got no success. And the problem is that there are NO ERRORS to debug!
The following changes should solve your issue.
Set a mail from address which is same as MAIL_USERNAME.
Change your mail driver to smtp.
Change mail encryption to ssl.
MAIL_DRIVER=smtp
MAIL_HOST=srv218.prodns.com.br
MAIL_PORT=465
MAIL_USERNAME=automatico#cepcar.com.br
MAIL_PASSWORD=*******
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=automatico#cepcar.com.br
the best solution is to make the following configuration in the .env file in hostgator to be able to send the emails with the corporate emails you have to define your domain on the host
MAIL_HOST= mail.<tu_dominio> => mail.amazonventas.com
MAIL_PORT=465 => estatico
MAIL_MAILER=smtp
MAIL_HOST=mail.amazonventas.com
MAIL_PORT=465
MAIL_USERNAME=**********#amazonventas.com
MAIL_PASSWORD="*********"
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=********#amazonventas.com
MAIL_FROM_NAME="${APP_NAME}"
MAIL_DRIVER=mailgun

forget password not working in laravel 5

I tried to click on link forget password and it says email has been sent but I didn't receive email
I am using gmail smpt in db config
I have already tried to change the setting in .env file but still nothing
This is mail config
MAIL_DRIVER=mail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=username#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
This isn't working it only says email has been sent but I didn't receive mail
I have also allowed in gmail to use Allow less secure apps: ON
so that app can directly send mail
You said you are using smpt driver. but in configuration you have set to mail.
So, you need to set MAIL_DRIVER from mail to smtp as given below:
'MAIL_DRIVER=smtp`.
Which password you are using ? Is that password which you are using to get login to gmail server ?
If yes then go to Myaccount of gmail then go to sign in and security and go to App password and generate password for Mail App and use that password.
May be that works for you. Same is working for me. Also change the following settings in your .env file.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_ENCRYPTION=tls
I changed the value of MAIL_DRIVER from mail to sendmail in the .env file
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=email#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
In account setting of gmail allow unsecured app to send mail works for me

Write a serveice class for send mail

I want to write a class for send mail with sendgrid on Laravel 5.1
I want to know better way to implement mail send function in Laravel.
I thought to create a serviceProvider. Is there any other suggestion for make better ?
Thanks in advance.
You can just use the Sendgrid SMTP server, as shown in their Laravel integration documentation.
Just edit your .env file like that:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_USERNAME=your Sendgrid username
MAIL_PASSWORD=your Sendgrid password
Then you can use Mail::send() just like you normally would.

Resources