| | |
| | | $address = 'MAILER-DAEMON'; |
| | | $name = substr($val, 0, -strlen($m[1])); |
| | | } |
| | | else if (preg_match('/('.$email_rx.')/', $val, $m)) { |
| | | $name = $m[1]; |
| | | } |
| | | else { |
| | | $name = $val; |
| | | } |
| | |
| | | |
| | | if (!$address && $name) { |
| | | $address = $name; |
| | | $name = ''; |
| | | } |
| | | |
| | | if ($address) { |
| | | $address = self::fix_email($address); |
| | | $result[$key] = array('name' => $name, 'address' => $address); |
| | | } |
| | | } |
| | |
| | | // remove space-stuffing |
| | | $line = preg_replace('/^\s/', '', $line); |
| | | |
| | | if (isset($text[$last]) && $line |
| | | if (isset($text[$last]) && $line && !$q_level |
| | | && $text[$last] != '-- ' |
| | | && $text[$last][strlen($text[$last])-1] == ' ' |
| | | ) { |
| | |
| | | return 'image/' . $type; |
| | | } |
| | | |
| | | /** |
| | | * Try to fix invalid email addresses |
| | | */ |
| | | public static function fix_email($email) |
| | | { |
| | | $parts = rcube_utils::explode_quoted_string('@', $email); |
| | | foreach ($parts as $idx => $part) { |
| | | // remove redundant quoting (#1490040) |
| | | if ($part[0] == '"' && preg_match('/^"([a-zA-Z0-9._+=-]+)"$/', $part, $m)) { |
| | | $parts[$idx] = $m[1]; |
| | | } |
| | | } |
| | | |
| | | return implode('@', $parts); |
| | | } |
| | | } |