Kirby->Email / SMTP Error (Timeout?)

Hi there,

we’ve been upgrading some of our Kirby instances to 3.4 and expecting some errors when using ‘email’ => [ ‘transport’ => [ ‘type’ => ‘smtp’, … in config or controllers which leads to timeouts. Sending without smtp / transport in config works fine.

We’e already set up a blank project to reproduce the issue and created templates/controllers as described in . Which works until we add smtp / account. Yes, login/pw are correct and work with Kirby 3.3.6 …

Hope you could help us how to address and fix this error.


To which version exactly have you upgraded? 3.4.0 or the latest 3.4.2?

we’ve upgraded to 3.4.0, 3.4.1 and 3.4.2 - not working at all.

Hm, there were changes to the email class and related classes, but as far as I can see, only in the latest version, not yet in 3.4.0. The PHPMailer dependency itself hasn’t changed.

I’ll try and test later, unless someone else knows what could be the issue here.

Do you have any further information or just the timeout error? Steps to reproduce?

That’s exactly why i couldn’t explain the issues to myself - it’s not that obvious like “email class has change with 3.4.1 and beforeSend”. :slight_smile:

Steps to reproduce:

Just idea :bulb:

Timeout errors can be caused by SSL. Can you test it in 3.4.2 with the beforeSend option as follows? I solved it before by disabling SSL verifying to an email server I couldn’t connect to.

    'from' => '',
    'to' => '',
    'subject' => 'Thank you for your contact request',
    'body' => 'We will never reply',
    'transport' => [
        'type' => 'smtp',
        'host' => '',
        'port' => 465,
        'security' => true,
        'auth' => true,
        'username' => '',
        'password' => 'randomString',
    // new feature that you can try with copy paste here
    'beforeSend' =>function ($mailer) {
        $mailer->SMTPOptions = [
            'ssl' => [
                'verify_peer' => false,
                'verify_peer_name' => false,
                'allow_self_signed' => true

        return $mailer;

Tested, with multiple Mail-Accounts on different servers/configs: unfortunately it didn’t work.

Did you test different port, security option? 587, 25, 110, ssl, tls, etc…

1 Like

Changing port should work. Otherwise, @jango, you should check your hosting and email server settings.

Tried some other ports, but didn’t change “security”.

We’ve set security = ‘ssl’ and kept the port (465), fixed it - thanks so much!

Seems like security = true won’t work with 3.4.x in this setting (like in the cookbook)?
Don’t know why this config breaks the mailer … Tried different mail accounts on different hostings which all worked fine with 3.3.6 .