【问题标题】:Laravel 5.2 reset password + MandrillLaravel 5.2 重置密码 + Mandrill
【发布时间】:2016-03-30 23:08:59
【问题描述】:

我有 Laravel 5.2 全新安装。

我做了以下操作:

  1. 我已经设置了我的.env 文件 MAIL_DRIVER=mandrill SECRET=my_mandrill_api_key
  2. 我已经安装了 Guzzle (https://github.com/guzzle/guzzle)
  3. 我已在视图中设置了我的电子邮件 (https://github.com/laravel/laravel/blob/5.0/resources/views/emails/password.blade.php)
  4. 我已修复证书问题 (PHP cURL error code 60)

所以看起来一切都正确。

当我填写电子邮件重置密码并按发送密码重置链接按钮时,我收到以下错误

服务器错误:POST https://mandrillapp.com/api/1.0/messages/send-raw.json 导致 500 Internal Server Error 回复: {"status":"error","code":-1,"name":"ValidationError","message":"你 必须指定一个键值”}

我已经检查了我在 Mandrill (https://mandrillapp.com/settings/api) 中的日志,没有记录我的操作。

从 Mandrill 的错误中,我知道它没有获取 api 密钥,所以由于某种原因,api 密钥和其他值没有传递给 Mandrill api。

问题:有什么遗漏/错误?

注意:现在我正在本地环境中构建应用程序。我的本地环境 Windows 10/Bitnami WAMP stack 7/我也在使用 Mandrill API。

【问题讨论】:

  • message":"你必须指定一个键值,你能添加函数的代码吗?

标签: laravel mandrill laravel-5.2


【解决方案1】:

如果您使用 Mandrill 驱动程序,则必须在 .env 文件中设置 MANDRILL_SECRET

其他设置MAIL_HOSTMAIL_PORT等是为了配合其他驱动使用。

请参阅有关使用 Mandrill 驱动程序的文档here。它提到您应该在 config/services.php 中设置 Mandrill 键,但您应该使用环境变量进行设置,因此如果您自定义了文件,请将其改回

'mandrill' => [
    'secret' => env('MANDRILL_SECRET'),
],

然后您将能够从 .env 文件中读取 MANDRILL_SECRET 值。

所以在您的 .env 文件中,您将拥有;

MAIL_DRIVER=mandrill
MANDRILL_SECRET=your_mandrill_key_here

【讨论】:

  • 我是从 .env 文件而不是服务中设置的,
  • 是的,我建议在那里进行更改,只需确保您的 config/services.php 看起来像 mandrill 组的那样。
  • 到目前为止感谢您的回答
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-12-18
  • 2016-09-25
  • 2015-05-27
  • 2017-08-04
相关资源
最近更新 更多