forked from Wavyzz/dolibarr
NEW Option MAIN_INFO_SOCIETE_MAIL_ALIASES to use different identities.
This commit is contained in:
@@ -393,13 +393,27 @@ if ($action == 'edit')
|
|||||||
// Separator
|
// Separator
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td colspan="2"> </td></tr>';
|
print '<tr '.$bc[$var].'><td colspan="2"> </td></tr>';
|
||||||
|
|
||||||
// From
|
// From
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
|
||||||
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><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>';
|
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
|
// From
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
|
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><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>';
|
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 '</table>';
|
||||||
|
|
||||||
print '<br><div class="center">';
|
print '<br><div class="center">';
|
||||||
@@ -530,7 +534,22 @@ else
|
|||||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
|
if (! empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Errors To
|
// 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;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
|
||||||
print '<td>'.$conf->global->MAIN_MAIL_ERRORS_TO;
|
print '<td>'.$conf->global->MAIN_MAIL_ERRORS_TO;
|
||||||
@@ -552,18 +571,7 @@ else
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
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>';
|
print '</table>';
|
||||||
|
|
||||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
||||||
@@ -583,6 +591,7 @@ else
|
|||||||
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
|
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Boutons actions
|
// Boutons actions
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
|
|||||||
@@ -201,11 +201,20 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
{
|
{
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
|
|
||||||
if(GETPOST('fromtype')==='user'){
|
$fromtype = GETPOST('fromtype');
|
||||||
|
if ($fromtype === 'user') {
|
||||||
$from = $user->getFullName($langs) .' <'.$user->email.'>';
|
$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.'>';
|
$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 {
|
else {
|
||||||
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
|
$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.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
|
||||||
$out.= '<tr><td width="180">'.$langs->trans("MailFrom").'</td><td>';
|
$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;
|
$out.= $this->fromname;
|
||||||
if ($this->frommail)
|
if ($this->frommail)
|
||||||
{
|
{
|
||||||
@@ -386,14 +390,32 @@ class FormMail extends Form
|
|||||||
$out.= '<span class="warning"> <'.$langs->trans('ErrorNoMailDefinedForThisUser').'> </span>';
|
$out.= '<span class="warning"> <'.$langs->trans('ErrorNoMailDefinedForThisUser').'> </span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$liste = array();
|
$liste = array();
|
||||||
$liste['user'] = $user->getFullName($langs) .' <'.$user->email.'>';
|
$liste['user'] = $user->getFullName($langs) .' <'.$user->email.'>';
|
||||||
$liste['company'] = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
|
$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.= ' '.$form->selectarray('fromtype', $liste, $this->fromtype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$out.= "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
$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_DISABLE_ALL_SMS=Disable all SMS sendings (for test purposes or demos)
|
||||||
MAIN_SMS_SENDMODE=Method to use to send SMS
|
MAIN_SMS_SENDMODE=Method to use to send SMS
|
||||||
MAIN_MAIL_SMS_FROM=Default sender phone number for Sms sending
|
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.
|
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/
|
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.
|
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