OJS 3 and Office356 emails

Hi all,

I am having problems with setting up email on Office356. I have no idea what can be wrong. This is my config:

smtp = On
smtp_server = smtp.office365.com
smtp_port = 587
smtp_auth = ssl
smtp_username = “xxxxxxxx”
smtp_password = “xxxxxxxxx”
allow_envelope_sender = on
default_envelope_sender = xxxxxxxx
time_between_emails = 3600
max_recipients = 10
require_validation = Off
validation_timeout = 14

I have tried with plain, SSL and TLS authentications. Before Office365 I worked with various different mails and it worked without problems, now it doesn’t.

Regards, Primož

What error message you receive after trying to send mail m essage?

Hi @vvucic,

Nothing useful:
[13-Sep-2018 20:13:31 Europe/Ljubljana] SMTP connect() failed. Troubleshooting · PHPMailer/PHPMailer Wiki · GitHub

I am not familiar with coding, so please give me detailed instructions how to debug.

Best regards, Primož

Does your mail server work? Please check it.
There must be some error message such as there is no smtp server… or so…

Hi @vvucic Finally I found something useful. The php error says “SMTP Error: data not accepted.” After some more digging into it I found out that the problem is within OJS as when sending email the from and reply to email addresses are not the same and Office365 refuses it.

Looking further how to solve this issue.

Best regards, Primož

Can you check settings of server and increase value

// default is 10
$mail->Timeout = 60;


Increase of value sometimes helps.
Are you sure that your office365.com server is not blocking you?

Hi @vvucic,

Thank you for your help.
The point is there is no ‘my’ Office365, I am using MS cloud version, so not the case.
Further on I have found out that if:

  • a user has the same email address that OJS is using for SMTP, it works
  • a user has any other email address it doesn’t work
    Beside that I have found some explanation on the WEB that can be the case. So I am concluding that is it.

Best regards, Primož

Please check this:
https://stackoverflow.com/questions/15880042/phpmailer-the-following-smtp-error-data-not-accepted#20887687