How to switch mail() functionality in OJS 3.1.1-4 on (or off)?

Greetings!

I want OJS to send emails. We are on 3.1.1-4 using XAMPP. I installed and set up PHPMailer and can send test emails through Gmail by browsing to a test php page on the localhost, so PHPMailer itself works.

Stupid question: what do I need to do now so OJS sends emails when people register, work on submissions, etc.? The “Email Settings” in config.inc.php is all commented out, so I thought mail() should be working once PHPMailer is installed. Is there one last obvious step I am missing?

I would like to narrow down the question:

If I have ;smtp = on in config.inc.php, SMTP is not used, so mail() should work instead. Where do I need to enter Gmail username and password so OJS can send mail? In C:\xampp\htdocs\journal\lib\pkp\lib\vendor\phpmailer\phpmailer*class.phpmailer.php*?

So far, I identified 3 files that have email related settings:

php.ini,
config.inc.php,
class.phpmailer.inc

Can anyone who is successfully using Gmail with OJS share which of these three files they have edited?

At the end of the day, I tried to use the example https://pkp.sfu.ca/wiki/index.php?title=Using_gmail_SMTP with a different email address and changed port 587 that I had entered before to 465 and everything started working again. There was no need to try PHPMailer or Sendmail solutions, after all.

hy I have a similar problem
did you try to send a mail to somebody with yahoo mail?
my doesent sen it i dont have any error …
no idea how to proceed … :frowning:

Hi @HCsaba,

My config.inc.php is set up to send via Gmail SMTP servers, but the recepients vary. I created fake submissions using test accounts that have Gmail and Hotmail emails, and I received email confirmations to both of them.

If, however, you are asking whether you can configure config.inc.php so it sends using Yahoo, I believe you would just substitute the example from https://pkp.sfu.ca/wiki/index.php?title=Using_gmail_SMTP with the Yahoo info from POP access settings and instructions for Yahoo Mail | Yahoo Help - SLN4724, and try first 465 and then 587. Hopefully, this would work, but if not, maybe someone on the list could help. I have not received any reply to my question, but I hope you will have more luck :slight_smile:

The intent within OJS is for all of the mail configurations to live in config.inc.php. If you enter SMTP configuration here (such as directly to Gmail), OJS will connect directly there. If you turn off SMTP here, then OJS will rely on your server’s native mail handling, via PHP’s mail() function. Many email providers are increasingly depending on compliance with SPF, DKIM, and DMARC standards which require that OJS’s sender be trusted by the recipient. Both Gmail and Yahoo have been early adopters of these standards.

You can find more discussion on this here:

The most recent changes on this are scheduled against 3.1.2: