Support the ongoing development of Laravel.io →
Installation Mail Packages
Last updated 1 year ago.
0

In case you haven't figured this out:

MAIL_DRIVER=smtp

If you set the driver to mandrill, it's going to try to send via the api in which case it will look to config/services for your api key and in your case, it will find an empty string and you get the uhappiness noted above.

If you want to send using the api, create an environment variable for your mandrill key and reference it in config/services like so:

  'mandrill' => [
        'secret' => env('MANDRILL_KEY'),
    ],
0

Hi, Set MAIL_DRIVER=smtp Results error in both cases Connection could not be established with host smtp.mandrillapp.com [Connection refused #111]

Set MAIL_DRIVER=mandrill It work in both cases But also had to set from email in /config/mail.php or else reset password wouldn't work

'from' => ['address' => env('MAIL_FROM_ADDRESS', null), 'name' => env('MAIL_FROM_NAME', null)],

I would like to know how to set from email specifically for the reset password. Any ideas?

Many thanks for the above answer, Shawn.

0

I haven't tried this, but overriding the ResetsPasswords trait by adding and updating the postEmail method to PasswordController should work (someone more experienced may know of a better way to do this):

Your PasswordController would look something like this (don't forget your imports):

   use ResetsPasswords;

    /**
     * Send a reset link to the given user.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function postEmail(Request $request)
    {
        $this->validate($request, ['email' => 'required|email']);

        $response = Password::sendResetLink($request->only('email'), function (Message $message) {
            $message->subject($this->getEmailSubject());
            $message->from('[email protected]', 'Name');
        });

        switch ($response) {
            case Password::RESET_LINK_SENT:
                return redirect()->back()->with('status', trans($response));

            case Password::INVALID_USER:
                return redirect()->back()->withErrors(['email' => trans($response)]);
        }
    }
0

In controller dont forget to add use Mail;

0

What do you mean by "don't forget your imports"?

FYI I am newbie

I tried use Mail; and others

0

Just work

use Illuminate\Http\Request;

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.