Hi,
I am trying to import some messages back into RC that have been exported
using the Save (.eml)
function. These files always seem to be written with
\n line endings. This isn't a problem with Dovecot (on Debian), the messages
are imported and displayed just fine in RC. But with hMailServer (on
Windows) there is a problem. The messages are imported ok but RC cannot
display them. If before importing the message I change the line endings from
\n to \r\n then RC displays the message fine on both servers.
I can open the file before importing it and change the line endings but I am wondering if I have missing something and there is a more elegant way of doing it, does anyone have any suggestions?
At the moment I am using this code:
// check message has correct line endings $message = file_get_contents($file); $message = preg_replace('/\r?\n/', $rcmail->config->header_delimiter(), $message); file_put_contents($file, $message);
Thanks,
Phil
List info: http://lists.roundcube.net/dev/ BT/aba52c80
On 08.09.2010 09:37, Phil Weir wrote:
I can open the file before importing it and change the line endings but I am wondering if I have missing something and there is a more elegant way of doing it, does anyone have any suggestions?
You need to make replacement before using rcube_imap_generic's appendFromFile(). You could use append() instead, but not for really big messages.
At the moment I am using this code:
// check message has correct line endings $message = file_get_contents($file); $message = preg_replace('/\r?\n/', $rcmail->config->header_delimiter(), $message);
Don't use header_delimiter() method. It should be used only for sending mail with mail() function. For SMTP/IMAP standard (\r\n) delimiter should be used always.
On Wed, 08 Sep 2010 09:55:58 +0200, "A.L.E.C" alec@alec.pl wrote:
On 08.09.2010 09:37, Phil Weir wrote:
I can open the file before importing it and change the line endings but I am wondering if I have missing something and there is a more elegant way of doing it, does anyone have any suggestions?
You need to make replacement before using rcube_imap_generic's appendFromFile(). You could use append() instead, but not for really big messages.
At the moment I am using this code:
// check message has correct line endings $message = file_get_contents($file); $message = preg_replace('/\r?\n/', $rcmail->config->header_delimiter(), $message);
Don't use header_delimiter() method. It should be used only for sending mail with mail() function. For SMTP/IMAP standard (\r\n) delimiter should be used always.
That works great Alec, thanks very much for your help.
Phil _______________________________________________ List info: http://lists.roundcube.net/dev/ BT/aba52c80