user4578154
user4578154

Reputation:

RequestException in CurlFactory.php line 187

I'm using Laravel 5.1 and want to send email but I'm getting this error:

RequestException in CurlFactory.php line 187:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

How could I solve this?
My .env file:

MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=oEontENjBIdIrzaXhk9v9Q

My function in controller:

public function mailContact(ContactRequest $request)
{
    $name = $request->input('name');
    $email = $request->input('email');
    $body = $request->input('body');
    $sent = Mail::send('emails.contact', compact('name', 'email', 'body'), function ($message) {
        $message->to('[email protected]', 'Admin')->subject('Message');
    });

    if ($sent) {
        return Redirect::back()->withMessage('تشکر از اینکه تماس گرفتید.');
    }

    return Redirect::back()->withError('متاسفانه ایمیل ارسال نشد.دوباره تلاش کنید');
}

Upvotes: 2

Views: 5895

Answers (2)

Ancon
Ancon

Reputation: 11

  1. Download the https://gist.github.com/VersatilityWerks/5719158/download
  2. Extract it an place it in ..\php\ext (curl.cainfo="E:\xampp\php\ext)"
  3. Open the php.ini and write after the php_curl.dll: curl.cainfo="..\php\ext\cacert.pem"(curl.cainfo="E:\xampp\php\ext\cacert.pem")
  4. Restart the web server.

Upvotes: 1

user4578154
user4578154

Reputation:

I added the cacert.pem file as described in http://codeontrack.com/solve-laravelxamppguzzlehttp-curl-error-60-no-sll-certificate/ but now I'm getting this error:

RequestException in CurlFactory.php line 187:
cURL error 77: error setting certificate verify locations:
CAfile: [pathtothisfile]\cacert.pem
CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Any help?

Upvotes: 0

Related Questions