Skip to content

Commit

Permalink
dev/core#4273 - CRM/Mailing - Allow user to configure donotreply from…
Browse files Browse the repository at this point in the history
… email address
  • Loading branch information
olayiwola-compucorp committed May 29, 2023
1 parent c75fcfd commit 56a14e1
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
1 change: 1 addition & 0 deletions CRM/Admin/Form/Preferences/Mailing.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class CRM_Admin_Form_Preferences_Mailing extends CRM_Admin_Form_Preferences {

protected $_settings = [
'profile_double_optin' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
'no_reply_email_address' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
'profile_add_to_group_double_optin' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
'track_civimail_replies' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
'civimail_workflow' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
Expand Down
6 changes: 5 additions & 1 deletion CRM/Core/BAO/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,11 @@ public static function getDefaultReceiptFrom() {
*/
public static function getNoReplyEmailAddress() {
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
return "do-not-reply@$emailDomain";
$noReplyAddress = \Civi\Api4\Setting::get(FALSE)
->addSelect('no_reply_email_address:label')
->execute()->first();

return $noReplyAddress['value'] ?: "do-not-reply@$emailDomain";
}

}
22 changes: 22 additions & 0 deletions settings/Mailing.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,28 @@
'description' => ts('When CiviMail is enabled, users who "subscribe" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.'),
'help_text' => NULL,
],
'no_reply_email_address' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'no_reply_email_address',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'select',
'html_attributes' => [
'class' => 'crm-select2',
],
'default' => NULL,
'pseudoconstant' => [
'optionGroupName' => 'from_email_address',
],
'add' => '5.63',
'title' => ts('Email From Address to use where a reply is not expected'),
'is_domain' => 1,
'is_contact' => 0,
'description' => '',
'help_text' => NULL,
'help' => ['id' => 'no_reply_email_address'],
],
'track_civimail_replies' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
Expand Down
18 changes: 18 additions & 0 deletions templates/CRM/Admin/Form/Preferences/Mailing.hlp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{htxt id="no_reply_email_address-title"}
{ts}Email From Address for no-reply emails.{/ts}
{/htxt}
{htxt id="no_reply_email_address"}
{capture assign=fromEmailOptionsURL}{crmURL p='civicrm/admin/options/from_email_address' q="reset=1"}{/capture}
<p>{ts 1=$fromEmailOptionsURL}Specify an Email From Address to use when the system sends an email but a reply is not expected, for example when a user is sent an email for a double opt-in.{/ts}</p>
<p>{ts 1=$fromEmailOptionsURL}Leaving this blank will use the default which will be do-not-reply@default_domain where the default_domain will be the email domain address of your default mailing account also used for bounce handling.{/ts}</p>
<p>{ts 1=$fromEmailOptionsURL}You can add additional Email From Addresses <a href='%1'>here</a>.{/ts}</p>
{/htxt}

0 comments on commit 56a14e1

Please sign in to comment.