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 Contact form | Kirby CMS . 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.
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?
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.
$kirby->email([
'from' => 'no-reply@supercompany.com',
'to' => 'someone@gmail.com',
'subject' => 'Thank you for your contact request',
'body' => 'We will never reply',
'transport' => [
'type' => 'smtp',
'host' => 'mail.getkirby.com',
'port' => 465,
'security' => true,
'auth' => true,
'username' => 'test@test.com',
'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;
}
]);
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 .