Reputation: 9369
I'm working in mail in laravel. I've following configuration.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=********
MAIL_PASSWORD=########
MAIL_ENCRYPTION=tls
I've already tried this one but not working
And many more similar question but still i don't get the solution. I've following error:
ErrorException (E_WARNING) stream_socket_enable_crypto(): Peer certificate CN=
gains.nanosupercloud.com' did not match expected CN=
smtp.sendgrid.net'
I don't know what i'm doing wrong. Here is the code used for email sending.
public function toMail($notifiable)
{
return (new MailMessage)
->from(\Config::get('values.app_email'),\Config::get('values.app_name'))
->subject('Successfully approved your Company')
->greeting(sprintf('Hello %s', $this->user->name))
->line('Your company has been approved successfully. Now, it will be visible to our website');
}
Any kind of suggestions are appreciated.
Note: Everything works perfectly in local server(ubantu 16.04)
Upvotes: 2
Views: 16222
Reputation: 11
using laravel 7 and deployed on godaddys shared hosting.
just put this data in .env file and problem is solved
MAIL_MAILER=sendmail
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME="****@domain.com"
MAIL_PASSWORD="password"
MAIL_ENCRYPTION="tls"
MAIL_FROM_ADDRESS="****@domain.com"
MAIL_FROM_NAME="${APP_NAME}"
Upvotes: 1
Reputation: 39
I had similar issue, what I did was change the
MAIL_DRIVER=smtp
to
MAIL_DRIVER=sendmail
And then clear cache with
php artisan config:cache
And everything went well
Upvotes: 2
Reputation: 2573
add this line in .env file to disable mail encryption
MAIL_ENCRYPTION = NULL
Upvotes: 2
Reputation: 1
It's the same happening with me. In local it's working fine but in the live server as am using the GoDaddy server same issue is araising continuously. but finally, it works. here are my codes below for the .env file.
MAIL_DRIVER=smtp
MAIL_HOST=abc.com
MAIL_PORT=25
[email protected]
MAIL_PASSWORD=******
MAIL_ENCRYPTION=
Hope it will work for you.
Upvotes: 0
Reputation: 6341
The answer i am giving may look funny but i have same error while sending mail in the live server
just change this
MAIL_DRIVER=smtp
to
MAIL_DRIVER=sendmail
I don't know the reason How the hell is this working but it works fine for me
Upvotes: 13