smtp issues with moodle

Anonymous
2025-03-18T14:28:37+00:00

I'm trying to config SMTP to my moodle using microsoft365 but for some reason it is not working. I managed to get the logs from my moodle but it seems like that is a password issue. And I've talked to the admin of microsoft365 and it says that the password does not expire, So I'm not sure what might be the cause.

This is the logs: 

2025-03-18 13:51:18	Connection: opening to smtp.office365.com:587, timeout=300, options=array()
2025-03-18 13:51:18	Connection: opened
2025-03-18 13:51:18	SERVER -> CLIENT: 220 AS9***1CA**05.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 18 Mar 2025 13:51:18 +0000 [08DD652161CEF541]
2025-03-18 13:51:18	CLIENT -> SERVER: EHLO moodle.gentis.org
2025-03-18 13:51:18	SERVER -> CLIENT: 250-AS9P***A*005.outlook.office365.com Hello [**8.1**.**6.*5]
                   	                  250-SIZE 157286400
                   	                  250-PIPELINING
                   	                  250-DSN
                   	                  250-ENHANCEDSTATUSCODES
                   	                  250-STARTTLS
                   	                  250-8BITMIME
                   	                  250-BINARYMIME
                   	                  250-CHUNKING
                   	                  250 SMTPUTF8
2025-03-18 13:51:18	CLIENT -> SERVER: STARTTLS
2025-03-18 13:51:18	SERVER -> CLIENT: 2** 2.0.0 SMTP server ready
2025-03-18 13:51:19	CLIENT -> SERVER: EHLO moodle.gentis.org
2025-03-18 13:51:19	SERVER -> CLIENT: 250-AS9****1CA0**5.outlook.office365.com Hello [**8.1**.**6.*5]
                   	                  250-SIZE 157286400
                   	                  250-PIPELINING
                   	                  250-DSN
                   	                  250-ENHANCEDSTATUSCODES
                   	                  250-AUTH LOGIN XOAUTH2
                   	                  250-8BITMIME
                   	                  250-BINARYMIME
                   	                  250-CHUNKING
                   	                  250 SMTPUTF8
2025-03-18 13:51:19	CLIENT -> SERVER: AUTH LOGIN
2025-03-18 13:51:19	SERVER -> CLIENT: 334 VXNlcm5hbWU6
2025-03-18 13:51:19	CLIENT -> SERVER: [credentials hidden]
2025-03-18 13:51:19	SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2025-03-18 13:51:19	CLIENT -> SERVER: [credentials hidden]
2025-03-18 13:51:24	SERVER -> CLIENT: 535 5.7.139 Authentication unsuccessful, user password has expired. [AS9P251CA0005.EURP251.PROD.OUTLOOK.COM 2025-03-18T13:51:24.319Z 08DD652161CEF541]
2025-03-18 13:51:24	SMTP ERROR: Password command failed: 535 5.7.139 Authentication unsuccessful, user password has expired. [AS9P251CA0005.EURP251.PROD.OUTLOOK.COM 2025-03-18T13:51:24.319Z 08DD652161CEF541]
2025-03-18 13:51:24	SMTP Error: Could not authenticate.
2025-03-18 13:51:24	CLIENT -> SERVER: QUIT
2025-03-18 13:51:24	SERVER -> CLIENT: 2** 2.*.0 Service closing transmission channel
2025-03-18 13:51:24	Connection: closed
2025-03-18 13:51:24	SMTP connect() failed. https://github.com/****ailer/PH**ailer/wiki/**oubl****oting 

PII has been removed by MSFT
Outlook | Web | Outlook on the web for business | Settings

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-03-19T11:20:55+00:00

    Hello admidiallo,

    Good day! Thank you for publishing in Microsoft Community. We are happy to assist you! First of all, I would like to express my sincere appreciation for the tremendous effort you've put into describing the entire scenario. Your detailed and thoughtful explanation is truly commendable.

    Based on your given description, it sounds frustrating to deal with SMTP issues, especially when the logs suggest a password problem, but the admin confirms the password doesn't expire. As per your given description, I have a general understanding. As per my general understanding, here are a few steps you may try:

    Double-check SMTP Settings:

    • SMTP Server: smtp.office365.com
    • Port: 587
    • Encryption: TLS
    • Authentication: Yes (use your full Microsoft 365 email address and password)

    Disable the Azure Security Defaults: 

    For more, please see: Providing a default level of security in Microsoft Entra ID - Microsoft Entra | Microsoft Learn

    Exclude the user from a Conditional Access policy that blocks Legacy Authentication:

    • Sign in to the Azure portal as a security administrator, conditional Access administrator, or Global administrator.
    • Browse to Azure Active Directory>Security>Conditional Access
    • In the policy that Blocks Legacy Authentication, exclude the mailbox being used under Users and Groups> Exclude
    • Select Save

    For more details, please kindly refer this: 535 5.7.139 Authentication unsuccessful - Microsoft Q&A

    If there is any update or I misunderstand you, please feel free to let me know. I will continue to assist you. Your understanding and co-operation are highly appreciated. Thanks for your precious time. Have a nice day!

    Sincerely

    Nafis Iqbal Shuvo

    Was this answer helpful?

    0 comments No comments