allow MAILGUN_API_KEY as override
This commit is contained in:
parent
740624b858
commit
aeeef428b9
@ -9,7 +9,8 @@ use CRM_Mailgunny_ExtensionUtil as E;
|
||||
*/
|
||||
class CRM_Mailgunny_Form_Settings extends CRM_Admin_Form_Setting {
|
||||
protected $_settings = [
|
||||
'mailgun_api_key' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
|
||||
'mailgun_api_key' => 'domain',
|
||||
//'mailgun_api_key' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
|
||||
];
|
||||
public function buildQuickForm() {
|
||||
parent::buildQuickForm();
|
||||
|
@ -53,11 +53,14 @@ class CRM_Mailgunny_Page_Webhook extends CRM_Core_Page {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get API key from Mailgun account.
|
||||
* Get API key for Mailgun account.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getApiKey() {
|
||||
if (defined('MAILGUN_API_KEY')) {
|
||||
return MAILGUN_API_KEY;
|
||||
}
|
||||
return Civi::settings()->get('mailgun_api_key');
|
||||
}
|
||||
|
||||
@ -103,7 +106,10 @@ class CRM_Mailgunny_Page_Webhook extends CRM_Core_Page {
|
||||
// Ideally we would have access to 'X-CiviMail-Bounce' but I don't think we do.
|
||||
$bounce_params = $this->extractVerpData($event);
|
||||
if (!$bounce_params) {
|
||||
throw new CRM_Mailgunny_WebhookRejectedException("Cannot find VERP data necessary to process bounce.");
|
||||
// @todo Find the email and put it on hold.
|
||||
Civi::log()->info("Mailgun Webhook: $event #noverp @todo find email and put on hold.");
|
||||
return;
|
||||
//throw new CRM_Mailgunny_WebhookRejectedException("Cannot find VERP data necessary to process bounce.");
|
||||
}
|
||||
$bounce_params['bounce_type_id'] = $this->getCiviBounceTypeId($type);
|
||||
$bounce_params['bounce_reason'] = ($event->{'delivery-status'}->description ?? '')
|
||||
@ -141,7 +147,7 @@ class CRM_Mailgunny_Page_Webhook extends CRM_Core_Page {
|
||||
return $verp_items;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Get CiviCRM bounce type.
|
||||
*
|
||||
* @param string Name of bounce type, e.g. Invalid|Syntax|Spam|Relay|Quota|Loop|Inactive|Host|Dns|Away|AOL
|
||||
|
@ -148,6 +148,9 @@ function mailgunny_civicrm_alterMailParams(&$params, $context) {
|
||||
// Copy this header to one that will be returned by Mailgun's webhook.
|
||||
$params['X-Mailgun-Variables'] = json_encode(['civimail-bounce' => $params['Return-Path']]);
|
||||
}
|
||||
else {
|
||||
// Probably a single email, for which we don't have any useful information to add.
|
||||
}
|
||||
/*
|
||||
⬦ $context = (string [10]) `flexmailer`
|
||||
⬦ $params['X-CiviMail-Mosaico'] = (string [3]) `Yes`
|
||||
|
@ -6,7 +6,7 @@ return [
|
||||
'title' => ts('Mailgun API key'),
|
||||
'description' => ts('The Mailgun API key for the sending domain'),
|
||||
'type' => 'String',
|
||||
'add' => '5.8',
|
||||
'add' => '5.0',
|
||||
'html_type' => 'text',
|
||||
'default' => '',
|
||||
'is_domain' => 1,
|
||||
|
Loading…
Reference in New Issue
Block a user