Laravel 5.2 reset password + Mandrill

爱⌒轻易说出口 提交于 2019-12-13 00:44:34

问题


I have Laravel 5.2 fresh installation.

I did following:

  1. I have set up my .env file MAIL_DRIVER=mandrill SECRET=my_mandrill_api_key
  2. I have installed Guzzle (https://github.com/guzzle/guzzle)
  3. I have setup my email in view (https://github.com/laravel/laravel/blob/5.0/resources/views/emails/password.blade.php)
  4. I have fixed the certificate issue (PHP cURL error code 60)

So it seems everything is done correctly.

When I fill email to reset password and press Send Password Reset Link button, I get following error

Server error: POST https://mandrillapp.com/api/1.0/messages/send-raw.json resulted in a 500 Internal Server Error response: {"status":"error","code":-1,"name":"ValidationError","message":"You must specify a key value"}

I have check my log in Mandrill (https://mandrillapp.com/settings/api) there is no logs for my action.

From the error of Mandrill, I know it does not get the api key, so for some reason the api key and other values is not passing over to Mandrill api.

Question: What is missing/wrong?

Note: right now I am working on my local environment building the app. My local environment Windows 10/Bitnami WAMP stack 7/ I am also using Mandrill API.


回答1:


If you are using the Mandrill driver then you must set the MANDRILL_SECRET in your .env file.

The other settings MAIL_HOST, MAIL_PORT and so on are for use with other drivers.

See the documentation here about using the Mandrill driver. It mentions that you should set the Mandrill key in config/services.php but you should really set that using an environment variable, so if you have customized the file change it back to

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

Then you will be able to read the MANDRILL_SECRET value from the .env file.

So in your .env file you'll have;

MAIL_DRIVER=mandrill
MANDRILL_SECRET=your_mandrill_key_here


来源:https://stackoverflow.com/questions/34453908/laravel-5-2-reset-password-mandrill

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!