【问题标题】:Mandrill not sending message山魈不发消息
【发布时间】:2015-03-24 12:53:23
【问题描述】:

我一直在尝试使用 Mandrill 发送邮件。

当我尝试发送这样的邮件时:

Mail::send('emails.sample',[], function ($message){
    $message->subject('Message Subject');
    $message->from('noreply@example.net', 'Sender Name');
    $message->to('anEmail@example.com'); // Recipient address

    return 'sent';
});

我收到错误 cURL 错误 60:SSL 证书问题:无法获得本地颁发者证书”。我已经做了很多谷歌并检查了堆栈流,但似乎没有明确的解决方案。一些在线解决方案上的帖子建议我忽略该警告并为 cURL 提供 -k 或将不安全的参数传递给它,这不知道该怎么做。请提供任何帮助

【问题讨论】:

  • 什么版本的 Laravel? app/config/mail.php 文件中设置的“驱动程序”键是什么?
  • 4.2 版,驱动程序设置为 mandrill
  • 您是否安装了 guzzle 4 软件包并在 app/config/services.php 中设置了您的密钥?
  • 您是否为您的服务器正确设置了证书和证书包。不要通过-kfalse 或类似的任何证书检查。验证您是否已为您的服务器安装了有效的 SSL/TLS 证书和 curl CAINFO 文件。 curl.haxx.se/docs/caextract.html

标签: laravel curl mandrill


【解决方案1】:

我在 WAMP 窗口上遇到了同样的问题。这是由于使用 SSL 的狂热。以下是我的解决方法

  1. 下载this archive 并解压cacert.pem 文件(我已将它放在wamp\bin\php 中)。
  2. 在 php.ini 中添加/取消注释 curl.cainfo =<.pem file folder>\cacert.pem

来源:laracasts.com

【讨论】:

    【解决方案2】:

    转到这个文件:\vendor\laravel\framework\src\Illuminate\Mail\Transport\MandrillTransport.php

    并添加这行代码:

    public function send(Swift_Mime_Message $message, &$failedRecipients = null)
    {
        $client = $this->getHttpClient();
        $client->setDefaultOption('verify', false); // ***add this***
        $client->post('https://mandrillapp.com/api/1.0/messages/send-raw.json', [
            'body' => [
                'key' => $this->key,
                'raw_message' => (string) $message,
                'async' => false,
            ],
        ]);
    }
    

    【讨论】:

      猜你喜欢
      • 2016-03-23
      • 2015-09-04
      • 2014-07-14
      • 2013-05-18
      • 2014-06-24
      • 2016-11-16
      • 2016-12-30
      • 2015-12-11
      • 1970-01-01
      相关资源
      最近更新 更多