I am sending emails from my Laravel project. In the localhost it works perfectly but after makes the site live it gives the following error.
The connection could not be established with host smtp.googlemail.com:stream_socket_client(): Peer certificate CN=`whm001.smart1marketing.com' did not match expected CN=`smtp.googlemail.com'
I am using same google configuration settings in which I used in Laravel , I have tried clearing all caches, etc. but no solution
Following is .env file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=mymail#gmail.com
MAIL_PASSWORD=my password
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=noreply#smart1leads.com
MAIL_FROM_NAME='LifeLoveAndOtherThings'
Related
I'm using ovh cloud server and laravel forge to manage my server, I don't know what happened exactly, I have websites and even wordpress installed , everything was fine and can send email from all websites, nowadays no website send email also no error in the log files, and the email function works fine but no email in inbox or even spam
I've tried changing mail to sendmail, the same issue
please advice me
MAIL_DRIVER=mail
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=noreply#****com
MAIL_PASSWORD=*******
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=noreply#*****.com
MAIL_FROM_NAME=“****”
If your using gmail, delete and create new app password. Here is my config
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=***#gmail.com
MAIL_PASSWORD="*****"
MAIL_ENCRYPTION=tls
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
stream_socket_enable_crypto(): Peer certificate CN=`cs723.mojohost.com' did not match expected CN=`smtp.sendgrid.net'
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)
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
add this line in .env file to disable mail encryption
MAIL_ENCRYPTION = NULL
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
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}"
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
MAIL_USERNAME=info#abc.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=
Hope it will work for you.
I have installed laravel script on web server but unable to properly configure email settings. I want to use my hosting provider email on laravel script.
The script sends email when user register or request for verification code.
Find the .env file and edit the following with your smtp information:
MAIL_DRIVER=smtp
MAIL_HOST=host
MAIL_PORT=port
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=null
I am sending mail from laravel its working fine on localhost but same code is not working on live server following is my mail configuration
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=pranav.bitware#gmail.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=ssl
i have allowed less secure apps in my account
i don't know why its generating error on live server
on some articles they are setting smtp to sendmail i tried that also but getting same error
Providing the error message you get will help with troubleshooting this issue. Since it works on your localhost, then you should look into the server configuration such as your php and Laravel setup, and firewall settings.
I used the artisan command "php artisan make:auth" And Users authentication and registration is working fine but for some reason the App just can't send the reset passwords email.
I was able to properly configure the env file and even receive the message; "We have e-mailed your password reset link!", but the email never reaches the recipient.
This is my env file:
MAIL_DRIVER=log
MAIL_HOST=smtp.liberumratings.com
MAIL_PORT=587
MAIL_USERNAME=website#liberumratings.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
I also tried the example below but a got this error:
(1/1) ErrorException
stream_socket_enable_crypto(): Peer certificate CN=*.locaweb.com.br'
did not match expected CN=smtp.liberumratings.com'
MAIL_DRIVER=smtp
MAIL_HOST=smtp.liberumratings.com
MAIL_PORT=587
MAIL_USERNAME=website#liberumratings.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
All my parameters are correct and I am able to send emails using the PHPMailer on the same server on another application.
The encryption might be wrong. Are you using SSL?
Remove the tls and try agian. Also your answer can be found here
Laravel SMTP driver with TLS encryption