Front end login code not being sent via Mailjet

I have just solved this, and it turned out to be something unbelivably silly, and would have saved hours of debugging had Mailjet mentioned it in the guide for the SMTP relay.

I will leave this here for anyone else who needs this…

What was missing was that you need to verify the email used to send the login codes via the Mailjet dashboard. So given the following email transport settings in the kirby config.php file using the Mailjet API keys..

'email' => [
  'transport' => [
    'type' => 'smtp',
    'host' => 'in-v3.mailjet.com',
    'port' => 587,
    'security' => 'tls',
    'auth' => true,
    'username' => MAILJET_PUBLIC_KEY,
    'password' => MAILJET_PRIVATE_KEY,

  ],
],

The crucial bit is this - Kirby by defualt will use the email address noreply@yourdomain.com as the sender for the login codes when you do a front end login or panel login via access code.

Before it will actually send anything you need to go into your Mailjet dashboard under “Domains and senders” and verify the email address noreply@yourdomain.com as an allowed sender. That means setting up that mailbox on your hosting because Mailjet will send a verfication email. Once you click the link in that email, then registration emails will send just fine.