From d67b0b1e6632c8dce655025ea49eb64e1f8776e0 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 10 Jan 2022 14:03:14 +0100 Subject: [PATCH] Avoid duplicating from email address when generating identity --- mail/inc/class.mail_compose.inc.php | 2 +- mail/inc/class.mail_tree.inc.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 069eb03bf3..47e8cf86f0 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -2463,7 +2463,7 @@ class mail_compose $email_From = $_identity['ident_email'] ? $_identity['ident_email'] : $activeMailProfile['ident_email']; // Try to fix identity email with no domain part set $_mailObject->setFrom(Mail::fixInvalidAliasAddress(Api\Accounts::id2name($_identity['account_id'], 'account_email'), $email_From), - mail_tree::getIdentityName($_identity)); + mail_tree::getIdentityName($_identity, false)); $_mailObject->addHeader('X-Priority', $_formData['priority']); $_mailObject->addHeader('X-Mailer', 'EGroupware-Mail'); diff --git a/mail/inc/class.mail_tree.inc.php b/mail/inc/class.mail_tree.inc.php index c288c8a37e..d5358523ce 100644 --- a/mail/inc/class.mail_tree.inc.php +++ b/mail/inc/class.mail_tree.inc.php @@ -543,9 +543,10 @@ class mail_tree * Build folder tree parent identity label * * @param array $_account + * @param bool $_fullString = true full or false=NamePart only is returned * @return string */ - static function getIdentityName ($_account) + static function getIdentityName ($_account, bool $_fullString=true) { $identLabel = $GLOBALS['egw_info']['user']['preferences']['mail']['identLabel']; $name = array(); @@ -567,12 +568,12 @@ class mail_tree if ($identLabel & self::ORG_NAME_EMAIL) { - $name[] = $_account['ident_org']." | ".$_account['ident_realname'].' '.' <'.$_account['ident_email'].'>'; + $name[] = $_account['ident_org']." | ".$_account['ident_realname'].($_fullString ? ' '.' <'.$_account['ident_email'].'>' : ''); } if ($identLabel & self::IDENT_EMAIL || empty($name)) { - if (strpos($_account['ident_email'], '@') !== false || trim($_account['ident_email']) !='') + if ($_fullString && (strpos($_account['ident_email'], '@') !== false || trim($_account['ident_email']) !='')) { $name[] = ' <'.$_account['ident_email'].'>'; }