Upgrading to 3.4.0.3, error related to PHPMailer

We tried to upgrade from 3.3.0.13 to 3.4.0.3 but got the following error: “[17-Oct-2023 05:32:27 UTC] PHP Fatal error: Uncaught Exception: Mailer driver isn’t specified in the application’s config in /home/…/public_html/lib/pkp/classes/core/PKPContainer.php:315.”

Our host has tried to upgrade but recognized a code issue, which is beyond the scope of their service. Our site does not use the PHPMailer. This is strange because all our previous upgrades were successful (with PHPMailer disabled).

========
In the PKPContainer.php file, I see the following lines:

  • Retrieves default mailer driver depending on the configuration
    *
    • @throws Exception
      */
      protected static function getDefaultMailer(): string
      {
      $default = Config::getVar(‘email’, ‘default’);

      if (!$default) {
      throw new Exception(‘Mailer driver isn't specified in the application's config’);
      }

      return $default;
      }
      the config file for the attempted upgrade includes the following lines:

; Enable SMTP authentication
; Supported smtp_auth: ssl, tls (see PHPMailer SMTPSecure)
; smtp_auth = ssl
; smtp_username = username
; smtp_password = password
;
; Supported smtp_authtype: RAM-MD5, LOGIN, PLAIN, XOAUTH2 (see PHPMailer AuthType)
; (Leave blank to try them in that order)
; smtp_authtype =

; The following are required for smtp_authtype = XOAUTH2 (e.g. GMail OAuth)
; (See Using Gmail with XOAUTH2 · PHPMailer/PHPMailer Wiki · GitHub)
; smtp_oauth_provider = Google
; smtp_oauth_email =
; smtp_oauth_clientid =
; smtp_oauth_clientsecret =
; smtp_oauth_refreshtoken =

; Enable suppressing verification of SMTP certificate in PHPMailer
; Note: this is not recommended per PHPMailer documentation
; smtp_suppress_cert_check = On

========

I tried to compare the settings in our current version 3.3.013, but there is no PKPContainer.php file in our current site. Our email services are still functional though.

Can 3.4.0.3 be installed without PHPMailer (since I want to keep it as it is), or what needs to be added to the PKPContainer.php and/or the config.inc.php?

Our config lines for the Mailer in 3.3.0.13:

=========

; Enable SMTP authentication
; Supported smtp_auth: ssl, tls (see PHPMailer SMTPSecure)
; smtp_auth = ssl
; smtp_username = username
; smtp_password = password
;
; Supported smtp_authtype: RAM-MD5, LOGIN, PLAIN, XOAUTH2 (see PHPMailer AuthType)
; (Leave blank to try them in that order)
; smtp_authtype =

; The following are required for smtp_authtype = XOAUTH2 (e.g. GMail OAuth)
; (See Using Gmail with XOAUTH2 · PHPMailer/PHPMailer Wiki · GitHub)
; smtp_oauth_provider = Google
; smtp_oauth_email =
; smtp_oauth_clientid =
; smtp_oauth_clientsecret =
; smtp_oauth_refreshtoken =

; Enable suppressing verification of SMTP certificate in PHPMailer
; Note: this is not recommended per PHPMailer documentation
; smtp_suppress_cert_check = On

=======
Thus, the failure is resulting from upgrading from 3.3.0.13 (without the PKPContainer.php) to 3.4.0.3 (that fails without this file) where the latter contains the PKPContainer.php file (referring to the config.inc.php file without PHPMailer setting.

Which files need to be edited for the installation to complete without PHPMailer? Even if we change, will future upgrades wipe out custom settings?

Any help would be appreciated. Thank you in advance! Arjun Sabharwal @asabhar

Hi @asabhar,

Have a look at the Email section of the 3.4 Release Notebook:

https://docs.pkp.sfu.ca/dev/release-notebooks/en/3.4-release-notebook#email

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you @asmecher !

I got the same solution from @Dimidrol just earlier today (and it solved his error), but it looks like the path leads to a subdirectory in the server/operating system (and only our host has access to that) so this may be different in all hosting environments. Can you please share a screenshot of what is in the
/usr/sbin/sendmail directory? Our host has also migrated from CentOS to a different Linux distro, so can we be sure that the sendmail_path = path is the same for all OJS installations?

We have been using OJS without PHPmailer. We had tried that in 2019 but there were email authentication issues. Can we continue without a built-in mailer in 3.4.0.3? If yes, what do I need to add to the config.inc.php file? Thank you, and I apologize for the cross-postings. I will just continue here.

I have also looked in the config.inc.php file (inherited from OJS 3.3.0.13), and do not see these specific lines:

=========

; Default method to send emails
; Available options: sendmail, smtp, log, phpmailer
default = sendmail

Servers that use sendmail may need to add the path to the sendmail binary:

; Path to the sendmail, -bs argument is for using SMTP protocol
sendmail_path = “/usr/sbin/sendmail -bs”

Are these lines in the config.inc.php file for 3.4.0.3. Can you please send me the config.inc.php file as it comes with 3.4.0.3? Thanks!

@asabhar

Hi @asabhar,

You’ll have to check with your hosting provider for details – but generally in Linux, /sbin/sendmail is the standard location for Sendmail to live.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you for all your help, @asmecher! The host has set up the server to sendmail, and it should go through now. The email authentication: well, we will have to figure that out on our end. Best! @asabhar

1 Like

Hi @asabhar,

Glad you’re moving closer to working! For our part, we’ll add the missing configuration content to the release notes for 3.4.0, where it looks like we forgot to include them.

Regards,
Alec Smecher
Public Knowledge Project Team

This topic was automatically closed after 10 days. New replies are no longer allowed.