Error: Could not instantiate mail function with $kirby->email

Hi all,

any idea why this error appears while sending mails with the contact form demo code?

thx for help.

Check this:

works! thanks alot!

I also have this damn error message “Could not instantiate mail function.”. Form ist hosted with Host Europe and they need this parameter ‘-f Adding it does not help and now I wonder, if I might add it at the wrong position?

I added it to the controller of the contact form. Oh … btw, I am using the mail contact form in the Cookbook.

                'template' => 'email',
                'from'     => '',
                'replyTo'  => $data['contactform-email'],
                'to'       => '',
                'subject'  => esc($data['contactform-name']) . ' hat eine Nachricht über die Website gesendet',
                'data'     => [
                    'text'   => esc($data['contactform-text']),
                    'sender' => esc($data['contactform-name']),

I also made sure that the standard email address needed by Host Europe also is set in their KIS. Any hint?

Thanks in advance and have a lovely day,


Hmm … I just read, that I actually don’t need the -f parameter, if I added a standard email:

Es ist möglich ohne den Parameter “-f” E-Mails aus Skripten zu versenden. Dazu ist es nötig eine Standard-E-Mail-Adresse im KIS einzurichten.

Strange. Why the heck to I get this error then?

Hey Marc! Is there anything in the PHP error logs or server error logs?

Hey. I just activated loggin errors. He did not have them turned on. I need to wait 15 minutes and try again to see if an error is recorded.

Hmm somehow it does not log anything. Neither on the website – as I set it to “Logging Output” to see if I get more info on the website. No chance to see any other info sadly. :frowning:

Hm, is sendmail enabled or are you sending mail via smtp transport?

Sendmail should be enabled. At least I used it with the form I built for the K2 version of this site. I thought, I do the shortcut and use the pre-built form, but I guess, I was wrong :joy:

Is there any other pre-built contact form around? Otherwise, I simply look into building my own again, as I have no idea why this is not sending.

OK. I found some more time today to check this and just wanted to notify you that it was a problem – as expected – with Host Europe and their way of dealing with stuff like this. All things (like their “Standard Email Address” and/or the -f parameter) were correctly set. But what my mistake was and what I did not know is, that you need to use an email address in the “from” field that is part of the web package you use the script in. You can’t use any email where the URL is not part of the package you run this script in. Even though you own the domain and run it on the same KIS or Server, it needs to be part of the Domain(s) you use in this package. This is strict, but makes sense in a way.

So now it is working perfectly.

1 Like