Skip to content

Commit

Permalink
[-] BO : FixBug - Remove second email in recipient
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome Nadaud committed Oct 10, 2013
1 parent 39a5431 commit 7899111
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions classes/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,36 +133,46 @@ public static function Send($id_lang, $template, $subject, $template_vars, $to,
{
foreach ($to as $key => $addr)
{
$to_name = null;
$addr = trim($addr);
if (!Validate::isEmail($addr))
{
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail address'), $die);
return false;
}

if (is_array($to_name))
{
if ($to_name && is_array($to_name) && Validate::isGenericName($to_name[$key]))
$to_name = $to_name[$key];
}
if ($to_name == null)
$to_name = $addr;
/* Encode accentuated chars */
if (function_exists('mb_encode_mimeheader'))
$to_list->addTo($addr, mb_encode_mimeheader($to_name, 'utf-8'));

if ($to_name == null || $to_name == $addr)
$to_name = '';
else
$to_list->addTo($addr, self::mimeEncode($to_name));
{
if (function_exists('mb_encode_mimeheader'))
$to_name = mb_encode_mimeheader($to_name, 'utf-8');
else
$to_name = self::mimeEncode($to_name);
}

$to_list->addTo($addr, $to_name);
}
$to_plugin = $to[0];
} else {
/* Simple recipient, one address */
$to_plugin = $to;
if ($to_name == null)
$to_name = $to;
if (function_exists('mb_encode_mimeheader'))
$to_list->addTo($to, mb_encode_mimeheader($to_name, 'utf-8'));
if ($to_name == null || $to_name == $to)
$to_name = '';
else
$to_list->addTo($to, self::mimeEncode($to_name));
{
if (function_exists('mb_encode_mimeheader'))
$to_name = mb_encode_mimeheader($to_name, 'utf-8');
else
$to_name = self::mimeEncode($to_name);
}

$to_list->addTo($to, $to_name);
}
if(isset($bcc)) {
$to_list->addBcc($bcc);
Expand Down

0 comments on commit 7899111

Please sign in to comment.