Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

maytham's avatar

Laravel 5.2 reset password + Mandrill

I have Laravel 5.2 fresh installation.

I did following:

1- I have set up my .env file

    MAIL_DRIVER=mandrill
    MAIL_HOST=smtp.mandrillapp.com
    MAIL_PORT=587
    MAIL_USERNAME=my_mandrill_email
    MAIL_PASSWORD=my_mandrill_key
    MAIL_ENCRYPTION=null

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 what I read in error message it seems that Mandrill is not getting the required values.

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

Btw, I have also asked this question on stackoverflow with luck to answer yet.

0 likes
6 replies
maytham's avatar

Thx for answer, seem it works, But is not that strange? when using mandrill then use smtp? do you know the reason, is that a bug?

bashy's avatar
bashy
Best Answer
Level 65

If you're using the API (mandrill driver), you need to set your API key up.

Go into config/services.php and you will see this

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

Set an ENV var for MANDRILL_SECRET so it uses that for the API requests.

Also

  • Remove the host, port, username, and password entries. They're for SMTP, not the API.
  • Update MAIL_ENCRYPTION to "tls".
2 likes
d3xt3r's avatar

No I wont say its a bug, If you are using driver as mandrill, it will use the API instead of smtp, in which case just set the below in services.php configuration

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

bashy's avatar

Only use the SMTP value if you want to use SMTP. It's slower than the API and doesn't require Guzzle package.

You asked why your setup wasn't working. Changing the driver to SMTP is not the solution to your original problem but enjoy :)

maytham's avatar

@premsaurav your solution works for SMTP, but I was using API thank you for your answer, I have chosen @bashy answer, thx to him as well

Please or to participate in this conversation.