| | |
| | | } |
| | | while ($line !== false && trim($line) == ''); |
| | | |
| | | if (!preg_match('/^From\s+-/', $line) && !preg_match('/^[a-z-_]+:\s+.+/i', $line)) { |
| | | if (!preg_match('/^From .+/', $line) && !preg_match('/^[a-z-_]+:\s+.+/i', $line)) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | fseek($fp, 0); |
| | | while (($line = fgets($fp)) !== false) { |
| | | // importing mbox file, split by From - lines |
| | | if (preg_match('/^From\s+-/', $line) && ($lastline == '' || substr($lastline, -2) == '--')) { |
| | | if ($lastline === '' && strncmp($line, 'From ', 5) === 0 && strlen($line) > 5) { |
| | | if (!empty($message)) { |
| | | // unquote ">From " lines in message body |
| | | $message = preg_replace('/\n>([>]*)From /', "\n\\1From ", $message); |
| | | if ($RCMAIL->storage->save_message(null, rtrim($message))) { |
| | | $imported++; |
| | | } |