POP3 an IMAP connecting to Office365 account

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
jstanley
Posts: 3
Joined: Tue Jun 14, 2022 3:28 pm

POP3 an IMAP connecting to Office365 account

Post by jstanley »

Script URL:
Version of script: 3.2.5
Hosting company: Krystal.uk
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:
I am trying to configure POP3 or IMAP Fetching using a Office 365 fully licenced user mailbox with POP and IMAP turn on.

For POP3 I've tried the following settings in HESK:
Host: outlook.office365.com
Port: 995
TLS
email address and password of the account I wish to check for messages. (below I have changed these to xyz)

With the above I get the following error:
Error: Password error: Logon failure: unknown user name or bad password.
Connecting to outlook.office365.com ...
S +OK The Microsoft Exchange POP3 service is ready. [TABPADIAUAAyADYANQBDAEEAMAAxADMAMQAuAEcAQgBSAFAAMgA2ADUALgBQAFIATwBEAC4ATwBVAFQATABPAE8ASwAuAEMATwBNAA==]
C USER xyz@xyz.com
S +OK
C PASS xyz
S -ERR Logon failure: unknown user name or bad password.

However, I know the username and password is correct as I am using the same credentials for the SMTP connection which is working and I am also able to log into OWA with the same credentials.

For IMAP I've tried the following settings in HESK:
Host: outlook.office365.com
Port: 993
SSL
Do not validate certificate
email address and password of the account I wish to check for messages.

With the above I get the following error:
Error: Can not authenticate to IMAP server: AUTHENTICATE failed.
Retrying PLAIN authentication after AUTHENTICATE failed.
Retrying PLAIN authentication after AUTHENTICATE failed.
Can not authenticate to IMAP server: AUTHENTICATE failed.

It seems whatever combination of settings I try I cannot get either of these to work.

I've checked with my web host and they are not blocking any of the above ports.

Any suggestions on what the issue might be or what to try next.

Many thanks
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: POP3 an IMAP connecting to Office365 account

Post by Klemen »

Maybe you need to create an app password for Hesk?
https://support.microsoft.com/en-us/acc ... 07799387e9

You may also need to enable basic authentication for IMAP and disable Azure Active Directory security defaults:
https://docs.microsoft.com/en-us/exchan ... ap-outlook
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
jstanley
Posts: 3
Joined: Tue Jun 14, 2022 3:28 pm

Re: POP3 an IMAP connecting to Office365 account

Post by jstanley »

Klemen wrote: Tue Jun 14, 2022 6:48 pm Maybe you need to create an app password for Hesk?
https://support.microsoft.com/en-us/acc ... 07799387e9

You may also need to enable basic authentication for IMAP and disable Azure Active Directory security defaults:
https://docs.microsoft.com/en-us/exchan ... ap-outlook
Thanks, I've checked and basic authentication is already enabled and we therefore do not use MFA.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: POP3 an IMAP connecting to Office365 account

Post by Klemen »

Can you try (at least temporarily) disabling Azure Active Directory security defaults, then waiting a few hours and see if that helps?
https://docs.microsoft.com/en-us/micros ... -worldwide
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
jstanley
Posts: 3
Joined: Tue Jun 14, 2022 3:28 pm

Re: POP3 an IMAP connecting to Office365 account

Post by jstanley »

Klemen wrote: Tue Jun 14, 2022 6:58 pm Can you try (at least temporarily) disabling Azure Active Directory security defaults, then waiting a few hours and see if that helps?
https://docs.microsoft.com/en-us/micros ... -worldwide
I disabled Azure Active Directory security defaults earlier today but unfortunately it hasn't made any difference
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: POP3 an IMAP connecting to Office365 account

Post by Klemen »

It's definitely something in the O365 settings (not your web host) because the connection to the O365 server is OK, the authentication fails. And I know several people who use O365 without problems in Hesk.

Are you able to create an app password even if you MFA disabled in O365?
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
MaxAsford
Posts: 1
Joined: Thu Jun 23, 2022 6:22 pm

Re: POP3 an IMAP connecting to Office365 account

Post by MaxAsford »

Hi, today this problem happened to me.

I tried everything that was said here...
I even tried the beta and stable version with a clean install.

Unfortunately, nothing worked.

Does anyone have a solution?
geffiams
Posts: 3
Joined: Mon Oct 31, 2022 6:29 pm

Re: POP3 an IMAP connecting to Office365 account

Post by geffiams »

Hello Jstanley,
This error comes about if you have activated OAUTH with a different email other than the one you are trying to use for pop. Ensure the email you inted to use for POP3 is the same as the one you have used to verify OAUTH.
Post Reply