Ignore:
Timestamp:
Oct 26, 2011 9:53:30 AM (19 months ago)
Author:
alec
Message:
  • Fix IDN address validation issue (#1488137)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/steps/mail/sendmail.inc

    r5302 r5369  
    160160    // address in brackets without name (do nothing) 
    161161    if (preg_match('/^<'.$email_regexp.'>$/', $item)) { 
    162       $item = rcube_idn_to_ascii($item); 
    163       $result[] = $item; 
     162      $item = rcube_idn_to_ascii(trim($item, '<>')); 
     163      $result[] = '<' . $item . '>'; 
    164164    // address without brackets and without name (add brackets) 
    165165    } else if (preg_match('/^'.$email_regexp.'$/', $item)) { 
    166166      $item = rcube_idn_to_ascii($item); 
    167       $result[] = '<'.$item.'>'; 
     167      $result[] = '<' . $item . '>'; 
    168168    // address with name (handle name) 
    169     } else if (preg_match('/'.$email_regexp.'>*$/', $item, $matches)) { 
     169    } else if (preg_match('/<*'.$email_regexp.'>*$/', $item, $matches)) { 
    170170      $address = $matches[0]; 
    171171      $name = str_replace($address, '', $item); 
     
    175175            $name = '"'.addcslashes($name, '"').'"'; 
    176176      } 
    177       $address = rcube_idn_to_ascii($address); 
    178       if (!preg_match('/^<'.$email_regexp.'>$/', $address)) 
    179         $address = '<'.$address.'>'; 
     177      $address = rcube_idn_to_ascii(trim($address, '<>')); 
     178      $address = '<' . $address . '>'; 
    180179 
    181180      $result[] = $name.' '.$address; 
Note: See TracChangeset for help on using the changeset viewer.