';
- if (!($this->fromtype === 'user' && $this->fromid > 0) && !($this->fromtype === 'company'))
+ if (! ($this->fromtype === 'user' && $this->fromid > 0)
+ && ! ($this->fromtype === 'company')
+ && ! preg_match('/user_aliases/', $this->fromtype)
+ && ! preg_match('/global_aliases/', $this->fromtype))
{
+ // Use this->fromname and this->frommail or error if not defined
$out.= $this->fromname;
if ($this->frommail)
{
@@ -386,14 +390,32 @@ class FormMail extends Form
$out.= ' <'.$langs->trans('ErrorNoMailDefinedForThisUser').'> ';
}
}
- }else{
+ } else {
$liste = array();
$liste['user'] = $user->getFullName($langs) .' <'.$user->email.'>';
$liste['company'] = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
+ // Add also email aliases if there is one
+ $listaliases=array('user_aliases'=>$user->email_aliases, 'global_aliases'=>$conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
+ foreach($listaliases as $typealias => $listalias)
+ {
+ $posalias=0;
+ $listaliasarray=explode(',', $listalias);
+ foreach ($listaliasarray as $listaliasval)
+ {
+ $posalias++;
+ $listaliasval=trim($listaliasval);
+ if ($listaliasval)
+ {
+ $listaliasval=preg_replace('/', '<', $listaliasval);
+ $listaliasval=preg_replace('/>/', '>', $listaliasval);
+ if (! preg_match('/</', $listaliasval)) $listaliasval='<'.$listaliasval.'>';
+ $liste[$typealias.'_'.$posalias]=$listaliasval;
+ }
+ }
+ }
$out.= ' '.$form->selectarray('fromtype', $liste, $this->fromtype, 0);
}
-
$out.= "
\n";
$out.= "\n";
}
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 579eb2c575a..3437a96a2a6 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -244,7 +244,9 @@ MAIN_MAIL_EMAIL_STARTTLS= Use TLS (STARTTLS) encrypt
MAIN_DISABLE_ALL_SMS=Disable all SMS sendings (for test purposes or demos)
MAIN_SMS_SENDMODE=Method to use to send SMS
MAIN_MAIL_SMS_FROM=Default sender phone number for Sms sending
-MAIN_MAIL_DEFAULT_FROMTYPE=Email to be used by default (User / Company)
+MAIN_MAIL_DEFAULT_FROMTYPE=Sender e-mail by default for manual sendings (User email or Company email)
+UserEmail=User email
+CompanyEmail=Company email
FeatureNotAvailableOnLinux=Feature not available on Unix like systems. Test your sendmail program locally.
SubmitTranslation=If translation for this language is not complete or you find errors, you can correct this by editing files into directory langs/%s and submit your change to www.transifex.com/dolibarr-association/dolibarr/
SubmitTranslationENUS=If translation for this language is not complete or you find errors, you can correct this by editing files into directory langs/%s and submit modified files on dolibarr.org/forum or for developers on github.com/Dolibarr/dolibarr.