[SOLVED] Trouble Getting Email to work with Exchange Online (Office 365 for Business)

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
ranfur8
Posts: 8
Joined: Wed Aug 16, 2023 11:21 am

[SOLVED] Trouble Getting Email to work with Exchange Online (Office 365 for Business)

Post by ranfur8 »

Script URL: ??
Version of script: 3.4.3
Hosting company: support.grupomosh.com
URL of phpinfo.php: https://support.grupomosh.com/phpinfo.php
URL of session_test.php: https://support.grupomosh.com/session_test.php
What terms did you try when SEARCHING for a solution: "HESK Office 365 SMTP ERROR: AUTH command failed: 451 4.7.0 Temporary server error" "HESK Not connecting with Office 365" "SMTP Error HESK Office 365" "Hesk error Error: Authentication failed: AUTH command failed office 365"
That got me to these help articles: https://www.hesk.com/knowledgebase/?article=93 and https://www.hesk.com/knowledgebase/inde ... rticle=111
I verified the OAuth Provider, it's working correctly and it's Verified.

Write your message below:

I'm trying to set up an Email account for Ticket Verifications, everything went fine up until the point of testing the connection, where I get the following error message:

Code: Select all

Error: Authentication failed: AUTH command failed
2023-08-16 10:55:42	SERVER -> CLIENT: 220 PA7P264CA0378.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 16 Aug 2023 10:55:42 +0000
2023-08-16 10:55:42	CLIENT -> SERVER: EHLO server-hesk
2023-08-16 10:55:42	SERVER -> CLIENT: 250-PA7P264CA0378.outlook.office365.com Hello [88.30.47.105]
                   	                  250-SIZE 157286400
                   	                  250-PIPELINING
                   	                  250-DSN
                   	                  250-ENHANCEDSTATUSCODES
                   	                  250-STARTTLS
                   	                  250-8BITMIME
                   	                  250-BINARYMIME
                   	                  250-CHUNKING
                   	                  250 SMTPUTF8
2023-08-16 10:55:42	CLIENT -> SERVER: STARTTLS
2023-08-16 10:55:42	SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2023-08-16 10:55:42	CLIENT -> SERVER: EHLO server-hesk
2023-08-16 10:55:42	SERVER -> CLIENT: 250-PA7P264CA0378.outlook.office365.com Hello [88.30.47.105]
                   	                  250-SIZE 157286400
                   	                  250-PIPELINING
                   	                  250-DSN
                   	                  250-ENHANCEDSTATUSCODES
                   	                  250-AUTH LOGIN XOAUTH2
                   	                  250-8BITMIME
                   	                  250-BINARYMIME
                   	                  250-CHUNKING
                   	                  250 SMTPUTF8
2023-08-16 10:55:42	CLIENT -> SERVER: AUTH XOAUTH2
 [[i]REDACTED[/i]]==
2023-08-16 10:55:44	SERVER -> CLIENT: 451 4.7.0 Temporary server error. Please try again later. PRX5  [PA7P264CA0378.FRAP264.PROD.OUTLOOK.COM 2023-08-16T10:55:44.437Z 08DB9ADC88A06FB8]
2023-08-16 10:55:44	SMTP ERROR: AUTH command failed: 451 4.7.0 Temporary server error. Please try again later. PRX5  [PA7P264CA0378.FRAP264.PROD.OUTLOOK.COM 2023-08-16T10:55:44.437Z 08DB9ADC88A06FB8]
I tried restarting the http server, I undoing and redoing all the OAuth configuration all over again in Azure but no luck, still the same error. The email address is correctly spelled, there is no password since I'm using OAuth. 2FA is enabled, and I cannot change that setting, but that shouldn't affect anything since I'm using OAuth. SMTP Access is allowed for all accounts on the Domain.
I ran out of options and my knowledge on these kinds of problems is limited because It's my first time using Office 365 and Exchange online in a professional setting.
Last edited by ranfur8 on Wed Aug 16, 2023 12:25 pm, edited 1 time in total.
Klemen
Site Admin
Posts: 10141
Joined: Fri Feb 11, 2005 4:04 pm

Re: Trouble Getting Email to work with Exchange Online (Office 365 for Business)

Post by Klemen »

Hard to say what is going on because the error message by Microsoft is not descriptive.

A few things I would try:

1. does the SMTP connect if you use Basic authentication and a password?

2. does the IMAP connection work?

3. any changes if you do this?
- open Hesk in a PRIVATE/INCOGNITO browser window
- go to Tools > Oauth Providers
- click the "Edit" icon next to your provider
- click "Save"
- you will be prompted to login into Microsoft 365; make 100% sure you login with the help desk email address (the one you are using SMTP with)
- when back at Hesk, go to Settings > Email and test again
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ranfur8
Posts: 8
Joined: Wed Aug 16, 2023 11:21 am

Re: Trouble Getting Email to work with Exchange Online (Office 365 for Business)

Post by ranfur8 »

you will be prompted to login into Microsoft 365; make 100% sure you login with the help desk email address (the one you are using SMTP with)
This was the issue, I was signing in with the account I use to manage Azure, not the one I was trying to set up for Hesk. I did not know that the OAuth was tied to one specific account but it makes a lot more sense now that I think about it.

Thank you very much for your quick response!
The issue can be marked as resolved, the mail notification are working now. ;D
Klemen
Site Admin
Posts: 10141
Joined: Fri Feb 11, 2005 4:04 pm

Re: [SOLVED] Trouble Getting Email to work with Exchange Online (Office 365 for Business)

Post by Klemen »

Glad to hear that solved it!
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply