return;
}
- if (!preg_match(';^<mailto:u\.(\d+)\.(\d+)\.(\w*)@(.*)>$;', $params['List-Unsubscribe'], $m)) {
+ $sep = preg_quote(Civi::settings()->get('verpSeparator'), ';');
+ $regex = ";^<mailto:[^>]*u{$sep}(\d+){$sep}(\d+){$sep}(\w*)@(.+)>$;";
+ if (!preg_match($regex, $params['List-Unsubscribe'], $m)) {
\Civi::log()->warning('Failed to set final value of List-Unsubscribe');
return;
}
parent::setUp();
$this->useTransaction();
CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0;
+ CRM_Core_BAO_MailSettings::defaultDAO(TRUE);
$this->_groupID = $this->groupCreate();
$this->createContactsInGroup(2, $this->_groupID);
$this->assertEquals(2, $getMembers('Removed')->count());
}
+ public function testHttpUnsubscribe_altVerp(): void {
+ CRM_Core_DAO::executeQuery('UPDATE civicrm_mail_settings SET localpart = "aeiou.aeiou-"');
+ CRM_Core_BAO_MailSettings::defaultDAO(TRUE);
+
+ try {
+ Civi::settings()->set('verpSeparator', '-');
+ $this->testHttpUnsubscribe();
+ }
+ finally {
+ $this->revertSetting('verpSeparator');
+ }
+ }
+
/**
* Generate a fully-formatted mailing (with body_text content).
*/