OJS 3 is not sending mail with the office365 SMTP settings

Hi,

Did anyone solve the problem?
I also encountered the same problem and it was killing me for more than 5 days. Anyway, the problem is solved for my case.

I have edited the Mail.inc.php file to see the ErrorLog file (@ /var/log/apache2/error.log) and found that “default_envelope_sender” (sender email as your smtp host email) was not set to $f[‘email’]); variable even it is assigned in the “config.inc.php” file.

/lib/pkp/classes/mail

try {
$success = $mailer->Send();
if (!$success) {
error_log($mailer->ErrorInfo.‘DAZ2_’);
error_log($mailer->Host);
error_log($mailer->Port);
error_log($mailer->SMTPSecure);
error_log($mailer->Username);
error_log($mailer->Password);
error_log($recipientInfo[‘email’]);
error_log($f[‘email’]); // default_envelope_sender
error_log($mailer->Subject);
error_log(’–Body: '.$mailBody);
return false;
}
} catch (phpmailerException $e) {
error_log($mailer->ErrorInfo.‘DAZ2_’);
return false;
}
return true;

$f[‘email’] = Config::getVar(‘email’, ‘default_envelope_sender’);
This line can not detect the “default_envelope_sender” from “config.inc.php” file. So,
$mailer->SetFrom($f[‘email’], $f[‘name’]);
this line can not set the FROM email address correctly. It takes the admin email address which was set to admin account.

So, I changed the admin email account e-mail address to my SMTP host email address and the system was working for smtp.office365.com setting.

Hope this may help to those who are facing the same problem still now.

; Use SMTP for sending mail instead of mail()
smtp = On

; SMTP server settings
smtp_server = smtp.office365.com
smtp_port = 587

; Enable SMTP authentication
; Supported mechanisms: ssl, tls
smtp_auth = tls
smtp_username = xxxx@xxxx.com
smtp_password = xxx

Thank you all. :wink: