freescout-help-desk/freescout

M365 SMTP not working anymore

Closed this issue · 5 comments

We have been using M365 to send emails without any issues until we upgraded to version 1.8.148. A client still using an older version of FreeScout is able to send replies successfully. However, when I switch to Amazon SES credentials, it works, but not with the M365 credentials anymore.

On our FreeScout Server, we have 3 different accounts from different M365 tenants (and thus different domains). It happens to all three of them. But using the same credentials on a FreeScout server version prior 1.8.148, it works right away.

IMG_0017
IMG_0021

Try to change line 52 in /app/Misc/Mail.php to the following:

const OAUTH_MICROSOFT_SMTP = 'smtp.office365.com';

After that you should be able to connect via OAuth on "Sending Emails" page. See https://github.com/freescout-help-desk/freescout/wiki/Connect-FreeScout-to-Microsoft-365-Exchange-via-oAuth#sending-emails

I have made the change you suggested, and rebooted the Server.
Still the same issue. Anything else I can try?

++ Starting Swift_SmtpTransport
<< 220 SG2PR04CA0206.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 14 Aug 2024 12:48:42 +0000 [08DCBBD72DBC631A]

EHLO --REMOVED--

<< 250-SG2PR04CA0206.outlook.office365.com Hello [2406:da18:f4:7000:4e19:ee3c:c4f8:b937]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8

STARTTLS

<< 220 2.0.0 SMTP server ready

EHLO --REMOVED--

<< 250-SG2PR04CA0206.outlook.office365.com Hello [2406:da18:f4:7000:4e19:ee3c:c4f8:b937]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH LOGIN XOAUTH2
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8

AUTH XOAUTH2 --REMOVED--

<< 535 5.7.3 Authentication unsuccessful [SG2PR04CA0206.apcprd04.prod.outlook.com 2024-08-14T12:48:48.901Z 08DCBBD72DBC631A]

!! Expected response code 235 but got code "535", with message "535 5.7.3 Authentication unsuccessful [SG2PR04CA0206.apcprd04.prod.outlook.com 2024-08-14T12:48:48.901Z 08DCBBD72DBC631A]
" (code: 535)
!! Expected response code 235 but got code "535", with message "535 5.7.3 Authentication unsuccessful [SG2PR04CA0206.apcprd04.prod.outlook.com 2024-08-14T12:48:48.901Z 08DCBBD72DBC631A]
"
Log data:
++ Starting Swift_SmtpTransport
<< 220 SG2PR04CA0206.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 14 Aug 2024 12:48:42 +0000 [08DCBBD72DBC631A]

EHLO 'REMOVED'

Have you Connected your "Sending Emails" settings to MS365 via OAuth following the instruction: https://github.com/freescout-help-desk/freescout/wiki/Connect-FreeScout-to-Microsoft-365-Exchange-via-oAuth#sending-emails

You can also email at support@freescout.net to check the issue.

Yes, I have. A moment ago, I disconnected the account from "Microsoft Exchange" and then reconnected it, which resolved the issue, eventually. However, it would be beneficial to avoid such interruptions in the future. As I mentioned previously, everything was functioning correctly until I upgraded to version 1.8.148. I assume this issue was not foreseeable for you; otherwise, it would have been highlighted in the release notes to make users aware of it.

Ok. It's not clear why you actually got this issue.