Email configuration problem with Office365

Re: Email configuration problem with Office365

by Leandro Pedro -
Number of replies: 7

Hi Michael,

Many thanks for the info. I tried both of your suggestions but I had no luck.

Regarding the mail test plugin, everything looks good but contradictory because it looks like the password fails but after that the authentication is successfull.

I tested the password with PHPMailer and it works perfectly well. The weird thing is that after this successfull authentication SMTP connect fails.


This is the final part of the mail test result:

.....

CLIENT -> SMTP: AUTH LOGIN

SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is "334 VXNlcm5hbWU6

"SMTP -> get_lines(): $data is "334 VXNlcm5hbWU6

"SMTP -> FROM SERVER:334 VXNlcm5hbWU6

CLIENT -> SMTP: (Username encoded base64-email address)

SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is "334 UGFzc3dvcmQ6

"SMTP -> get_lines(): $data is "334 UGFzc3dvcmQ6

"SMTP -> FROM SERVER:334 UGFzc3dvcmQ6

CLIENT -> SMTP: (Username encoded base64-email address account password)

SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is ""SMTP -> get_lines(): $data is ""SMTP -> get_lines(): timed-out (10 sec)SMTP -> FROM SERVER:SMTP -> ERROR: Password command failed: CLIENT -> SMTP: QUIT

SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is "235 2.7.0 Authentication successful target host SN2PR20MB0896.namprd20.prod.outlook.com

"SMTP -> get_lines(): $data is "235 2.7.0 Authentication successful target host SN2PR20MB0896.namprd20.prod.outlook.com

"SMTP -> FROM SERVER:235 2.7.0 Authentication successful target host SN2PR20MB0896.namprd20.prod.outlook.com

SMTP -> ERROR: QUIT command failed: 235 2.7.0 Authentication successful target host SN2PR20MB0896.namprd20.prod.outlook.com

SMTP connect() failed.


Is there any ideas for this behavior? how can I resolve this issue?


Thanks in advance for your help!


Regards.

Leandro

In reply to Leandro Pedro

Re: Email configuration problem with Office365

by Leandro Pedro -

Hi guys,

Could anyone give me a hand with this issue?


Thanks in advance for your help!


Regards.

Leandro

In reply to Leandro Pedro

Re: Email configuration problem with Office365

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I guess I would start with the user account you are using...double check the password, check permissions...try creating a new user and use that account...

In reply to Emma Richardson

Re: Email configuration problem with Office365

by Leandro Pedro -

Hi Emma,

I tried with diferent users and I tested this users and passwords with PHPMailer and it works perfectly well.

So it is not aproblem of username and password.

Does Office365 have any special configuration? any other setup in moodle?


Regards.

Leandro

In reply to Leandro Pedro

Re: Email configuration problem with Office365

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Are you using oauth? Or are you just wanting the email part to work?

In reply to Emma Richardson

Re: Email configuration problem with Office365

by Leandro Pedro -

No, we are not using office authentication. We just want to setup the email account to send notifications.

In reply to Leandro Pedro

Re: Email configuration problem with Office365

by Martin Hannig -

Hello 

we have the same problem with using Office365 as SMTP mail server. It simply doesn't work. 

trying to find a solution since months. did you fix the problem?  someone with an idea? 

Martin

BKaL Cologne 

In reply to Martin Hannig

Re: Email configuration problem with Office365

by Leandro Pedro -

Hello Martin,

It looks like we finally solved the problem. I found this discussion https://moodle.org/mod/forum/discuss.php?d=321521 that made me check the version of phpmailer. 

The version of phpmailer that I had was v5.2.7 and in the previous link you can see that this version has a problem with TLS encryption.

We replaced class.smtp.php and class.phpmailer.php with the once included in Moodle 3.1 (phpmailer v5.2.14) and it worked.

One note, this also worked having "always send from no-reply" checked and the support account email has to be the same as the email username you are loging to the smtp.


I hope I had helped.

Regards and thanks to all!

Leandro