Fix clean email syntax to remove , to avoid error RFC-5321 address

This commit is contained in:
Laurent Destailleur
2018-04-10 11:15:21 +02:00
parent fae509e41d
commit 65996c47ff
3 changed files with 10 additions and 10 deletions

View File

@@ -191,7 +191,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// Recipient was provided from combo list
if ($val == 'thirdparty') // Id of third party
{
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
$tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
}
elseif ($val) // Id du contact
{
@@ -221,7 +221,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// Recipient was provided from combo list
if ($val == 'thirdparty') // Id of third party
{
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
$tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
}
elseif ($val) // Id du contact
{
@@ -245,13 +245,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$fromtype = GETPOST('fromtype','alpha');
if ($fromtype === 'robot') {
$from = $conf->global->MAIN_MAIL_EMAIL_FROM .' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
$from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")) .' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
}
elseif ($fromtype === 'user') {
$from = $user->getFullName($langs) .' <'.$user->email.'>';
$from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")) .' <'.$user->email.'>';
}
elseif ($fromtype === 'company') {
$from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")) .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
}
elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
$tmp=explode(',', $user->email_aliases);
@@ -267,14 +267,14 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$obj = $db->fetch_object($resql);
if ($obj)
{
$from = $obj->label.' <'.$obj->email.'>';
$from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>';
}
}
else {
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
$from = dol_string_nospecial($_POST['fromname'], ' ', array(",")) . ' <' . $_POST['frommail'] .'>';
}
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
$replyto = dol_string_nospecial($_POST['replytoname'], ' ', array(",")). ' <' . $_POST['replytomail'].'>';
$message = GETPOST('message','none');
$subject = GETPOST('subject','none');

View File

@@ -939,7 +939,7 @@ function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
* @param int $keepb 1=Preserve b tags (otherwise, remove them)
* @param int $keepn 1=Preserve \r\n strings (otherwise, replace them with escaped value)
* @return string Escaped string
* @see dol_string_nohtmltag
* @see dol_string_nohtmltag, dol_string_nospecial, dol_string_unaccent
*/
function dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
{

View File

@@ -2407,7 +2407,7 @@ class Societe extends CommonObject
{
$obj = $this->db->fetch_object($resql);
if ($mode == 'email') $contact_property = dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">";
if ($mode == 'email') $contact_property = dol_string_nospecial(dolGetFirstLastname($obj->firstname, $obj->lastname), ' ', array(","))." <".$obj->email.">";
else if ($mode == 'mobile') $contact_property = $obj->phone_mobile;
}
return $contact_property;