Sending email is not working in ojs 2.4.8

I am using OJs 2.4.8. Only User Validation email is working rest all email is not working, I can’t figure out exact problem. I tried to send mail manually through OJS but its not delivering even submission acknowledge mail also not working.
Another problem is that if I set "smtp = On " and configure my mail detail then step 5 of submission process can not complete only keep waiting in last it ends with database error.
I hope to get solution here.
Thanks

The errors should be either captured in your webserver’s error log (in the event of a PHP error), or to your mailserver’s log (in the event of a local sendmail/postfix error, or in the event of an SMTP error).

Can you post the error message(s) here? You may need the assistance of your system admin, or root access, for some of the error logs.

Thanks for attention. Error log is give as–
[18-Feb-2016 03:36:44 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 03:36:44 America/New_York] ojs2: DB Error: MySQL server has gone away
[18-Feb-2016 03:38:57 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 03:38:57 America/New_York] ojs2: DB Error: MySQL server has gone away
[18-Feb-2016 03:42:37 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 03:42:37 America/New_York] ojs2: DB Error: MySQL server has gone away
[18-Feb-2016 03:48:04 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 03:48:04 America/New_York] ojs2: DB Error: MySQL server has gone away
[18-Feb-2016 04:03:27 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 04:03:27 America/New_York] ojs2: DB Error: MySQL server has gone away
[18-Feb-2016 04:17:11 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 04:17:11 America/New_York] ojs2: DB Error: MySQL server has gone away
[18-Feb-2016 04:23:11 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 04:23:11 America/New_York] ojs2: DB Error: MySQL server has gone away
[18-Feb-2016 07:20:29 America/New_York] PHP Fatal error: Call to a member function getId() on null in /home/aijrin/public_html/journals/lib/pkp/pages/notification/NotificationHandler.inc.php on line 367
[18-Feb-2016 07:30:11 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 07:31:33 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 07:32:27 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 07:33:18 America/New_York] OJS SMTPMailer: Did not receive expected 220
[18-Feb-2016 07:33:58 America/New_York] OJS SMTPMailer: Did not receive expected 220

You’ll want to verify your SMTP configuration with the email provider, and perhaps your webserver’s connection (check for firewalls or proxies?) to the mailserver. This error is reporting that when OJS attempts the initial connection to the mailserver, it never receives a response that the mailserver is ready. It may be that waiting for the 220 response takes so long that it exceeds mysql’s timeout.

I changed to gmail setting and found following error
[18-Feb-2016 07:48:24 America/New_York] ojs2 has produced an error
Message: WARNING: fsockopen(): unable to connect to smtp.gmail.com:465 (Connection timed out)
In file: /home/aijrin/public_html/journals/lib/pkp/classes/mail/SMTPMailer.inc.php
At line: 165
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.6.17
Apache Version: N/A
DB Driver: mysql
DB server version:
[18-Feb-2016 07:49:52 America/New_York] ojs2 has produced an error
Message: WARNING: fsockopen(): unable to connect to smtp.gmail.com:465 (Connection timed out)
In file: /home/aijrin/public_html/journals/lib/pkp/classes/mail/SMTPMailer.inc.php
At line: 165
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.6.17
Apache Version: N/A
DB Driver: mysql
DB server version:
[18-Feb-2016 07:52:50 America/New_York] ojs2 has produced an error
Message: WARNING: fsockopen(): unable to connect to smtp.gmail.com:587 (Connection timed out)
In file: /home/aijrin/public_html/journals/lib/pkp/classes/mail/SMTPMailer.inc.php
At line: 165
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.6.17
Apache Version: N/A
DB Driver: mysql
DB server version:

However if I off smtp then password reset and new user validate mail is working but for submission acknowledgement mail following error is showing-

[18-Feb-2016 09:21:16 America/New_York] ojs2: Invalid filter id!

And anyother mail sending not working except user validate and password reset

To trace mail being sent by PHP’s mail function (when SMTP is off), you’ll need to look at your systems maillogs. This is probably managed by sendmail or postfix, and likely requires root permission to view. Do you have root access or a system admin who can help?

From those mail logs, you should be able to see if other messages are getting off-server, or why they are failing if they are not getting off-server.

I have root access but I dont know where can I find mail logs

This will depend on your flavor of Linux. For example, RHEL is usually configured with the log at: /var/log/maillog

in Var folder I have only empty cpanel and styled folder …but if some server problem then why 2 mail (User-validate and pass reset) is working and rest is not working? I am using Hosting24 shared hosting

If you are on shared hosting and are accessing via cpanel, you probably don’t have root access.

Check with your hosting provide for help with the mail logs.

If the emails which are not working make it to the mail subsystem but don’t go further, the error message will be there.

ok, I will ask them and let you know with reply…
Thanks

They will likely want a particular date/time and from and to address to find the relevant log messages.

Hi!!
My email sending problem still exist. only password reset and validation mail working properly. If I try to send mail to any user its unable to deliver, in error log i found following errors.

[02-Apr-2016 17:36:57 America/New_York] OJS SMTPMailer: Did not receive expected 250 (3)
[02-Apr-2016 17:51:17 America/New_York] OJS SMTPMailer: Did not receive expected 250 (3)
[02-Apr-2016 18:09:01 America/New_York] OJS SMTPMailer: Did not receive expected 250 (3)
[03-Apr-2016 10:30:32 America/New_York] OJS SMTPMailer: Did not receive expected 250 (3)
[03-Apr-2016 10:31:54 America/New_York] OJS SMTPMailer: Did not receive expected 250 (3)
[03-Apr-2016 10:58:02 America/New_York] OJS SMTPMailer: Did not receive expected 250 (3)
[03-Apr-2016 11:02:19 America/New_York] OJS SMTPMailer: Did not receive expected 250 (3)

I contacted to hosting provider for mail log, they replied that sending mail by smtp is working fine and to investigate further they want to know URL address of mail script, I ask them where to find this. They ask me "May I know how do you execute SMTPmailer using your software? How do you start the e-mail sending (SMTPmailer) script? "

Can you please help me in resolving this issue and What is URL of mail script?? What should i reply them regarding how I execute smtpmailer.

Thanks

One possibility is that your Site Principal Contact is a valid sender from this SMTP connection, but your Journal Principal Contact is not. The password reset and user validation messages come from the Site Principal Contact, but most other messages will come from the Journal Principal Contact.

The actual SMTP connection code is in the shared library:

Thanks for your reply!!
Today I noticed New thing regarding mail sending issue, I am unable to send any mail only if login from site admin user account which I created during installation of ojs. If I login with any other account then mail can send. I used other id with journal manager and editor privilege both working fine but if I use my site admin ID I cant send mail using any role.
I checked by changing site principal contact and journal principal contact still issue is same.
Any help regarding this behaviour?

Is there something unique about the Site Administrator’s email address? It will be used to set a reply-to for the email, and perhaps your SMTP provider is disallowing it for some reason.

I cant figure out anything special with admin email id. I am using gmail however other user id using gmail for registration is working.

If it is helpful for you hosting provider, the specific SMTP response that is failing is the “250” after the end-of-message character (a line with a single “.” on it.)

This generally means that the SMTP server is doing post processing after receiving the message, and has invalidated it for some reason.

If you give them the sender, recipient, and date and time of the email, their logs might offer more clues.

Thanks for your help, I will try to get some clue from hosting provider. For now I will use different id than site admin for editor and JM so that things can work as expected and wait for OJS 3.

please take a look on this link