Page MenuHomePhabricator

Unusued PHPMailer was actually being used
Closed, ResolvedPublic

Description

When this patch https://gerrit.wikimedia.org/r/c/wikimedia/fundraising/crm/+/1108507 was deployed it broke the recurring queue consumer

I reverted it to stop the queue from failing but should figure out what was going on here

Details

Related Changes in Gerrit:

Event Timeline

Looks like we hit the case when CIVICRM_SMTP_HOST wasn't defined:

public function getMailer() {
  if (!$this->activeMailer) {
    // Short term huckery config - this can be set in civicrm.settings.php
    if (getenv('CIVICRM_SMTP_HOST')) {
      if (!defined('CIVICRM_SMTP_HOST')) {
        define('CIVICRM_SMTP_HOST', getenv('CIVICRM_SMTP_HOST'));
      }
      $this->setActiveMailer('smtp');
    }
    else {
      // deprecated.
      $this->setActiveMailer('phpmailer');
    }
  }
  return $this->activeMailer;
}

I don't see CIVICRM_SMTP_HOST in the settings anywhere yet - it's just being set on the command line in the process-control jobs, e.g:

environment:
    CIVICRM_SMTP_HOST: "tls://frmx1001.frack.eqiad.wmnet:25;tls://frmx2001.frack.codfw.wmnet:25"

We could either add it to the recurring queue consumer process-control job and remember to add it to any other jobs that might send email, or we could add a fallback env line in civicrm.settings.php:

if (!getenv('CIVICRM_SMTP_HOST')) {
  putenv('CIVICRM_SMTP_HOST', 'tls://frmx1001.frack.eqiad.wmnet:25;tls://frmx2001.frack.codfw.wmnet:25')
}

Any preferences?

(We should also remove that deprecated 'else' block in getMailer() when we re-apply the MailerPHPMailer removal.)

I went with the second option, so we don't have to worry about running into the issue again if we add new queue consumers. The putenv syntax ended up being slightly different:

if (!getenv('CIVICRM_SMTP_HOST')) {
  putenv('CIVICRM_SMTP_HOST'=tls://frmx1001.frack.eqiad.wmnet:25;tls://frmx2001.frack.codfw.wmnet:25');
}

Change #1114453 had a related patch set uploaded (by Ejegg; author: Eileen):

[wikimedia/fundraising/crm@master] Remove unused phpMailer (take 2)

https://gerrit.wikimedia.org/r/1114453

Change #1114453 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Remove unused phpMailer (take 2)

https://gerrit.wikimedia.org/r/1114453

XenoRyet set Final Story Points to 2.