简体   繁体   中英

Mailgun: How can send email from my local machine (Laravel)

I have setup Mailgun on my Laravel project, the project will be deployed on a (Lan based) local server which hopefully connected to internet, email should be sent from the local machine where the project is being hosted, it works great on my dev server but when I try to send email from my local machine it returns below error.

在此处输入图片说明

cURL error 60: SSL cert issue when sending email with artisan command

You can either modify the vendor folder GuzzleHttp\\Client change verify key to false from configureDefaults method as I did in my local machine

or

You can read this conversation in Laracasts and try downloading the .pem files in some of the comments.

Here are some links:

After that you should edit your php.ini file accordingly:

curl.cainfo = "[pathtothisfile]\cacert.pem"

PS: I would just edit the vendor file, because it's much faster and not hard to realize.

The reason is because the mailgun/guzzleHttp looking for valid certificate (SSL issue) for security reasons. You can solve it like below (Wamp server):

1- Download this file from http://curl.haxx.se/ca/cacert.pem and put this in "C:/wamp64/bin/php/(your php version)/extras/ssl/" directory

2- find all php.ini files (even php.ini-production and php.ini-development ) under this directory "C:/wamp64/bin/php/php (your php version)"

3- find these following parts in above .ini files and edit it as shown:

curl.cainfo = "C:/wamp64/bin/php/(your php version)/extras/ssl/cacert.pem"
openssl.cafile= "C:/wamp64/bin/php/(your php version)/extras/ssl/cacert.pem"

4- clear cache laravel and restart your laravel server

5- restart wamp server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM