Error with Password-Reset "could not instantiate mail function"

i can’t get the new password-reset via email to work on the server (hosteurope).
when i test the general functionality on the server, this works:

mail ('tilman@brauchbarkeit.de', "Test", 'works!', '', "-f info@aic.cologne");

as i know that hosteurope requires the ‘-f param’ my configuration in kirby looks like this:

'email' => [
    'presets' => [
        'contact' => [
            'from' => 'info@aic.cologne'
        ]
    ]
]

phpinfo() gives me the following sendmail-path:

/usr/sbin/sendmail -t -i

however, i keep getting the “could not instantiate mail function”-error when trying to use the function :frowning:

Could you please post the full error output including the stacktrace?

sure! i am working on getting the error-reporting to work on the server :disappointed:

ok, turns out there is no error being logged! is there anything i can add to the sources that will produce a helpful output?

You can enable the debug mode to get a full error output:

Please take a look at your browser’s debug console and also at the HTTP response output from the API in the network tab.

unfortunately, this is all i get:

also enabling debug-mode in kirby does not yield any further details…

i went into the code of PHPMailer.php and it turns out, if i change line 1814 from

$params = sprintf('-f%s', $this->Sender);

to

$params = sprintf('-finfo@aic.cologne', $this->Sender);

it works. So the email.presets.contact.from defined in the config is not being passed as "Sender’ to the PHPMailer. Should this be the case?

EDIT: $this->Sender is always a generic email, in my case: “noreply@aic.ddev.site”!? how do i pass the Sender into PHPMailer?

Ah, that explains it! You can override the sender address for password reset emails with the auth.challenge.email.from option.

Your contact preset doesn’t apply to the password reset emails (that don’t use the preset), which is why you are currently always getting the generic noreply sender.

1 Like

Thanks Lukas! So many options, blessing and curse at the same time :angel:-:japanese_ogre: