forked from Wavyzz/dolibarr
NEW Option MAIN_INFO_SOCIETE_MAIL_ALIASES to use different identities.
This commit is contained in:
@@ -400,6 +400,20 @@ if ($action == 'edit')
|
||||
print '<td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_FROM)?$conf->global->MAIN_MAIL_EMAIL_FROM:'');
|
||||
print '"></td></tr>';
|
||||
|
||||
// Default from type
|
||||
$var=!$var;
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail');
|
||||
|
||||
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
|
||||
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE',$liste,$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE,0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Separator
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="2"> </td></tr>';
|
||||
|
||||
// From
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
|
||||
@@ -412,16 +426,6 @@ if ($action == 'edit')
|
||||
print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)?$conf->global->MAIN_MAIL_AUTOCOPY_TO:'');
|
||||
print '"></td></tr>';
|
||||
|
||||
// Default from type
|
||||
$var=!$var;
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('User');
|
||||
$liste['company'] = $langs->trans('Company');
|
||||
|
||||
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
|
||||
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE',$liste,$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE,0);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
@@ -530,6 +534,21 @@ else
|
||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Default from type
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
|
||||
print '<td>';
|
||||
if($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user'){
|
||||
print $langs->trans('UserEmail');
|
||||
} else {
|
||||
print $langs->trans('CompanyEmail');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Separator
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="2"> </td></tr>';
|
||||
|
||||
// Errors To
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
|
||||
@@ -552,17 +571,6 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
//Default from type
|
||||
$var=!$var;
|
||||
|
||||
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
|
||||
print '<td>';
|
||||
if($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user'){
|
||||
print $langs->trans('User');
|
||||
} else {
|
||||
print $langs->trans('Company');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@@ -583,6 +591,7 @@ else
|
||||
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
|
||||
}
|
||||
|
||||
|
||||
// Boutons actions
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
@@ -201,11 +201,20 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
{
|
||||
$langs->load("commercial");
|
||||
|
||||
if(GETPOST('fromtype')==='user'){
|
||||
$fromtype = GETPOST('fromtype');
|
||||
if ($fromtype === 'user') {
|
||||
$from = $user->getFullName($langs) .' <'.$user->email.'>';
|
||||
|
||||
}elseif( GETPOST('fromtype')==='company'){
|
||||
}
|
||||
elseif ($fromtype === 'company') {
|
||||
$from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
|
||||
}
|
||||
elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
|
||||
$tmp=explode(',', $user->email_aliases);
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
}
|
||||
elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
|
||||
$tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
}
|
||||
else {
|
||||
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
|
||||
|
||||
@@ -371,8 +371,12 @@ class FormMail extends Form
|
||||
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
|
||||
$out.= '<tr><td width="180">'.$langs->trans("MailFrom").'</td><td>';
|
||||
|
||||
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.= '<span class="warning"> <'.$langs->trans('ErrorNoMailDefinedForThisUser').'> </span>';
|
||||
}
|
||||
}
|
||||
}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.= "</td></tr>\n";
|
||||
$out.= "</td></tr>\n";
|
||||
}
|
||||
|
||||
@@ -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 <b>langs/%s</b> 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 <b>langs/%s</b> and submit modified files on dolibarr.org/forum or for developers on github.com/Dolibarr/dolibarr.
|
||||
|
||||
Reference in New Issue
Block a user