Emails for Passwordless or 2fa Login not sent anymore

I have Kirby running on a server for quite some time, back when I set it up for passwordless Login I got emails just fine. Last week I wanted to login again to check some stuff and I never got an Email.

I have a different Kirby site running locally which I updated to the latest 4.0.0 beta 3 to test the new 2fa feature. Again I don’t get a first email with the 6 digit key. I have a statamic site (running on a server and locally) with a contact form and the same email address information and I recieve emails just fine.

I don’t know what has changed since it used to work and I have no idea how to find out what the issue us.

return [
  'auth' => [
    'methods' => 'code'
  ],
  'email' => [
    'transport' => [
      'type' => 'smtp',
      'host' => 'HOST',
      'port' => 465,
      'security' => 'ssl',
      'username' => 'EMAIL',
      'password' => 'PASSWORD',
    ],
  ],
];

Any ideas or suggestions on how to find out what the issue is?

Have you tried to send an email via kirby()->email() with the same transport settings for testing?

Created a simple contact form and then I get this error:

The form could not be sent: The following From address failed: @*.com : MAIL FROM command failed,You are not authenticated. Try to activate SMTP Authentication in your mail client. ,550,SMTP server error: MAIL FROM command failed Detail: You are not authenticated. Try to activate SMTP Authentication in your mail client. SMTP code: 550

I then switched ‘security’ from ‘ssl’ to true. When I submit the form it just keeps on loading. I created a complete new local kirby instance with the starter kit, added the email transport and auth method to ‘code’. With security to ssl I get the login with the code input field instantly but no email. With security set to true the login button loads until I get a error about 2 minutes later:

The JSON response could not be parsed
504 Gateway Time-out

I run the local Kirby site with Valet.

Have you set the auth.challenge.email.from option (I think that’s advisable on localhost)

Then ideally test locally with something like MailHog (to check if it works in general)

Mailhog worked locally with auth.challenge.email.from. I added auth.challenge.email.from also on the server and now it works there as well.

Thanks a lot :slight_smile: