salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.57k stars 2.11k forks source link

Outbound/Inbound Mail: Office365 SMTP Error: Could not authenticate. v7.13 #9899

Open bunglex opened 1 year ago

bunglex commented 1 year ago

Issue

Can't set 'Outbound Email' or create 'Personal Outbound Email Account because authentication fails.

Expected Behavior

After setting up 'External OAuth Provider' and 'External OAuth Connector' and successfully retrieving an Access and Refresh Token, you should able to configure 'Outbound Email Settings' and setup a 'Personal Outbound Email Account', and also create inbound email account.

In the detail page for Personal Outbound Email Account , the 'send test email' should send test email when the correct settings are used.

Actual Behavior

In the detail page for Personal Outbound Email Account , the 'send test email' fails and returns an SMTP log that states

Authentication unsuccessful, the user credentials were incorrect. SMTP Error: Could not authenticate.

SuiteCRm logs :

[FATAL] Using imap handler class: Imap2Handler
[FATAL] An Imap error detected: "IMAP open error: Can not authenticate to IMAP server: A0001 NO AUTHENTICATE failed."
[FATAL] An Imap error detected: "IMAP open error | debug data"
[FATAL] An Imap error detected: "ImapHandler:open: {outlook.office365.com:993\/service=imap\/ssl\/tls\/validate-cert\/secure}INBOX"
[FATAL] An Imap error detected: "ImapHandler:open: Info"
[FATAL] An Imap error detected: "ImapHandler:open: password is empty: no"
[FATAL] An Imap error detected: "ImapHandler:open: 512"
[FATAL] An Imap error detected: "IMAP open error | debug data end "
[FATAL] ImapHandler trying to use a non valid resource stream.
[FATAL] An Imap error detected: "IMAP open error:Can not authenticate to IMAP server: A0001 NO AUTHENTICATE failed."
[FATAL] ImapHandler trying to use a non valid resource stream.
[FATAL] ImapHandler trying to use a non valid resource stream.
[FATAL] An Imap error detected: "IMAP open error: Can not authenticate to IMAP server: A0001 NO AUTHENTICATE failed."
[FATAL] An Imap error detected: "IMAP open error | debug data"
[FATAL] An Imap error detected: "ImapHandler:open: {outlook.office365.com:993\/service=imap\/ssl\/tls\/validate-cert\/secure}INBOX"
[FATAL] An Imap error detected: "ImapHandler:open: Info"
[FATAL] An Imap error detected: "ImapHandler:open: password is empty: no"
[FATAL] An Imap error detected: "ImapHandler:open: 512"
[FATAL] An Imap error detected: "IMAP open error | debug data end "
[FATAL] ImapHandler trying to use a non valid resource stream.
[FATAL] An Imap error detected: "IMAP open error:Can not authenticate to IMAP server: A0001 NO AUTHENTICATE failed."
[FATAL] ImapHandler trying to use a non valid resource stream.
[FATAL] ImapHandler trying to use a non valid resource stream.
[FATAL] An Imap error detected: "IMAP open error: Can not authenticate to IMAP server: A0001 NO AUTHENTICATE failed."
[FATAL] An Imap error detected: "IMAP open error | debug data"
[FATAL] An Imap error detected: "ImapHandler:open: {outlook.office365.com:993\/service=imap\/ssl\/tls\/validate-cert\/secure}INBOX"
[FATAL] An Imap error detected: "ImapHandler:open: Info"
[FATAL] An Imap error detected: "ImapHandler:open: password is empty: no"
[FATAL] An Imap error detected: "ImapHandler:open: 512"
[FATAL] An Imap error detected: "IMAP open error | debug data end "
[FATAL] ImapHandler trying to use a non valid resource stream.
[FATAL] An Imap error detected: "IMAP open error:Can not authenticate to IMAP server: A0001 NO AUTHENTICATE failed."
[FATAL] ImapHandler trying to use a non valid resource stream.
[FATAL] ImapHandler trying to use a non valid resource stream.
[FATAL] An Imap error detected: "Can not authenticate to IMAP server: A0001 NO AUTHENTICATE failed."

However, if you re-enter the password 'after' opening the page, the test succeeds and the email is sent correctly.
forum post here

Possible Fix

unknown

Steps to Reproduce

  1. Log into SuiteCRM as admin
  2. Go to Admin > Outbound Email
  3. Create or select/edit a Personal Outbound Email Account
  4. Exchange Server: outlook.office365.com
  5. Mail SMTP/SLL: TLS
  6. Exchange Server Port: 587
  7. User SMTP Authentication: X
  8. Password: your O365 password
  9. Send Test email

Authentication fails and displays SMTP Log

  1. Enter Password again
  2. Send Test Email

Test passes and email is sent

Context

Can't setup an office365 outbound or inbound email account

Your Environment

SuiteBot commented 1 year ago

This issue has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/oauth-connection-for-inbound-emails/87421/5

SuiteBot commented 1 year ago

This issue has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/imaphandler-errors-how-to-setup-inbound-email-for-office365-v7-12-5/87565/8

timo-ecm2 commented 1 year ago

Yes I have a similar issue, only I was specific busy with inbound email account.

greentreegroup commented 1 year ago

we are also having issues connecting m365 to suitecrm when sending emails.

timo-ecm2 commented 1 year ago

What about connecting to a gmail account, happens the same?

bunglex commented 1 year ago

the password is saved and the email sent correctly when using a gmail account ?

timo-ecm2 commented 1 year ago

ok thnx @bunglex for the information. Do you know where I can find a good manual / information for a gmail account

Lehnerr commented 1 year ago

I have the same issue, pls help

pgorod commented 1 year ago

Does this still occur on the latest 7.13?

Lehnerr commented 1 year ago

yes 7.13.2

SuiteBot commented 1 year ago

This issue has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/email-setup-help-and-explanation/88999/2

pstevens71 commented 1 year ago

I suspect it might be this issue: there is a fix proposed and it works (I tested it). https://github.com/salesagility/SuiteCRM/issues/9457

chris001 commented 1 year ago

@pstevens71 That link leads to a non existent page.... this is the one: https://github.com/salesagility/SuiteCRM/issues/9457

pstevens71 commented 1 year ago

The previous #9457 doesn't seem to work for me on 7.13.3. I just cannot seem to authenticate outbound email. I've tried ins sugarmailer.php to use the debugging to force the correct password and it works no problem. However, I cannot get test to work or after it's saved to work. I checked the DB and there are values in the password. Anyone know the password encryption? Is it MD5?

Also further info.... when using a gmail account with an app password, I can send a test and verify. However, the user cannot send with this account. (yes I have the option selected).

rmunoz10 commented 4 months ago

v7.14.4 Inbound fails too.

Sat Aug 3 10:37:00 2024 [21013][1][FATAL] ImapHandler trying to use a non valid resource stream. Sat Aug 3 10:37:00 2024 [21013][1][FATAL] ImapHandler trying to use a non valid resource stream. Sat Aug 3 10:38:00 2024 [21013][1][FATAL] An Imap error detected: "IMAP open error: Can not authenticate to IMAP server: Empty startup greeting (outlook.office365.com:993)" Sat Aug 3 10:38:00 2024 [21013][1][FATAL] An Imap error detected: "IMAP open error | debug data" Sat Aug 3 10:38:00 2024 [21013][1][FATAL] An Imap error detected: "ImapHandler:open: {outlook.office365.com:993\/service=imap}INBOX"

pstevens71 commented 4 months ago

Hey @rmunoz you can't use IMAP for O365, it's no longer supported. You have to setup Oauth.

rmunoz commented 4 months ago

@pstevens71 I guess you mean @rmunoz10 :D