Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#4273 - CRM/Mailing - Allow user to configure donotreply email address #26180

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 3 additions & 1 deletion CRM/Core/BAO/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@ public static function getDefaultReceiptFrom() {
*/
public static function getNoReplyEmailAddress() {
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
return "do-not-reply@$emailDomain";
$noReplyAddress = Civi::settings()->get('no_reply_email_address');

return $noReplyAddress ?: "do-not-reply@$emailDomain";
}

}
4 changes: 4 additions & 0 deletions CRM/Utils/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,10 @@ public static function boolean($value) {
* @return bool
*/
public static function email($value): bool {
if ($value === '' || is_null($value)) {
// Nothing to check
return TRUE;
}
if (function_exists('idn_to_ascii')) {
$parts = explode('@', $value);
foreach ($parts as &$part) {
Expand Down
16 changes: 16 additions & 0 deletions settings/Mailing.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@
'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',
'html_type' => 'text',
'default' => NULL,
'add' => '5.63',
'title' => ts('No-Reply Address'),
'validate_callback' => 'CRM_Utils_Rule::email',
'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
16 changes: 16 additions & 0 deletions templates/CRM/Admin/Form/Preferences/Mailing.hlp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{*
+--------------------------------------------------------------------+
| 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"}
<p>{ts}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}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>
{/htxt}