How to use Office 365 with modern authentication using Kirbys built-in email?

Hi, previously I have used Kirby’s built-in email with settings in config.php with Office 365 and smtp basic authentication. It has worked great.

An example:

<?php

return [
	'email' => [
		'presets' => [
			'contact' => [
				'from' => 'noreply@example.com',
			]
		],
		'transport' => [
			'type' => 'smtp',
			'port' => 587,
			'security' => 'tls',
			'host' => 'smtp.office365.com',
			'auth' => true,
			'username' => 'noreply@example.com',
			'password' => '...',
		]
	],
];

But today I was informed that basic authentication for Office 365 will stop working on October 1 2022 (so already passed).
https://www.microsoft.com/en-us/microsoft-365/blog/2022/09/01/microsoft-retires-basic-authentication-in-exchange-online/

Does anyone here have experience setting up Kirby with Office 365 and MFA (modern authentication) for a simple contact form?

I don’t have personal experience with sending emails via Office 365. From what I read in the Microsoft Tech Community, it should be possible to generate an “app password” from your Office 365 account. This app password can then be used with SMTP like before.

1 Like

Did you find a solution for this? I’m also having issues sending a form via smtp.office365.com using Kirby Uniform.

Not directly. There was no time to explore it in the project. But luckily it was possible to set in office365 to allow less security on selected e-mails. Don’t know exactly how though, because it was handled by an external company. So I run as usual like the example code in the thread.

Hi @jamiehunter, I was wondering how you went with this?

I am having issues as well when sending a form via smpt.office365.com. I have requested that the client verifies that “SMTP Authentication” is enabled in their Office 365 admin account. Hopefully that helps me solve the issue.

For anybody else facing issues with Office 365. It worked for me after client enabled “SMTP Authentication” in their Office 365 admin account and using 'security' => 'tls'.

2 Likes