|
 Tom - 2007-04-02 19:51:27
Hi,
i have another problem where i spend hours.
I want give the mime parser a Data String to parse. I get the String via pop3 like this:
if(($error=$pop3->RetrieveMessage(2,$headers,$body,-1))=="")
{
for($line=0;$line<count($headers);$line++)
{$message_file=$message_file.$headers[$line].chr(10).chr(13);}
for($line=0;$line<count($body);$line++)
{$message_file=$message_file.$body[$line].chr(10).chr(13);}
The problem was, i don't get parsed array strings, i get only one string like this:
["return-path:"]=>
string(656) "
X-Original-To: myadress@mydomain.de
Delivered-To: myadress@mydomain.de
Received: from h1093988.serverkompetenz.net (xxxxx.serverkompetenz.net [x.y.z.u])
by xxxx.serverkompetenz.net (Postfix) with SMTP id 03E6D2F4321
for ; Mon, 2 Apr 2007 13:47:42 +0200 (CEST)
Date: Mon, 02 Apr 2007 13:49:10 +0200 (CEST)
Errors-To:
From: myadress@mydomain.de
To: myadress@mydomain.de
Subject: asd
MIME-Version: 1.0
Message-ID:
X-Priority: 3
X-Mailer: nexxmail 1.2.2.17 [linux]
X-MAIL-FROM:
Content-Type: text/plain; charset="iso-8859-1""
}
["Parts"]=>
array(0) {
}
["BodyFile"]=>
string(52) "/srv/www/xxx.yyy.de/htdocs/data/mail/53/tmp/1"
["BodyPart"]=>
int(1)
["BodyLength"]=>
int(12)
How must i define the "Data" String for the parser ?
Greets Tom
 Manuel Lemos - 2007-04-03 07:43:38 - In reply to message 1 from Tom
You are using the incorrect line break sequence. It should be chr(13).chr(10) .
 Tom - 2007-04-03 09:55:57 - In reply to message 2 from Manuel Lemos
Hi Manuel,
i've tested alle combinations of the linebreak sequence. On some messages (Outlook Mails) the sequence works fine, but not on all. This message don't work:
-----raw mail begin------
Return-Path: <myadress@mydomain.de>
X-Original-To: myadress@mydomain.de
Delivered-To: myadress@mydomain.de
Received: from xxxxx.serverkompetenz.net (xxxxx.serverkompetenz.net [127.0.0.1]) by xxxxx.serverkompetenz.net (Postfix) with SMTP id 0EA112F431E for <myadress@mydomain.de>; Tue, 3 Apr 2007 11:46:54 +0200 (CEST)
Date: Tue, 03 Apr 2007 11:48:22 +0200 (CEST)
Errors-To: <myadress@mydomain.de>
From: myadress@mydomain.de
To: myadress@mydomain.de
Subject: test subject
MIME-Version: 1.0
Message-ID: <RT9o5tR6.nexxmail@xxxx.yyyyy.de>
X-Priority: 3
X-Mailer: nexxmail 1.2.2.17 [linux]
X-MAIL-FROM: <myadress@mydomain.de>
Content-Type: text/plain; charset="iso-8859-1"
this is a test message
----raw mail end------
The Problem is the Body content "this is a test message".
If i parse this message the decoder says:
MIME message decoding error: reached a premature end of data
Any ideas why ?
Greetings Tom
 Tom - 2007-04-03 10:23:28 - In reply to message 3 from Tom
I have found the beasty error. Between Header and Body must be a extra cr/lf like this:
for($line=0;$line<count($headers);$line++)
{$message_file=$message_file.$headers[$line].chr(13).chr(10);}
--- extra linebreak ---
$message_file=$message_file.$body[$line].chr(13).chr(10);
----
for($line=0;$line<count($body);$line++)
{$message_file=$message_file.$body[$line].chr(13).chr(10);}
Thanx Manuel for your mime parse class ! They works great. I've tested many mime parse classes (incl. PEAR class), but yours work absolutly great without errors.
Tom
 Manuel Lemos - 2007-04-03 17:38:30 - In reply to message 4 from Tom
Actually, it would be more efficient if you used the OpenMessage and GetMessage functions, instead of RetrieveMessage.
 Tom - 2007-09-11 09:40:25 - In reply to message 5 from Manuel Lemos
Hi Manuel,
i found no sample file for the method OpenMessage and GetMessage (?)
Have yo a sample file ?
Greets Tom
 Manuel Lemos - 2007-09-11 15:51:16 - In reply to message 6 from Tom
Currently there is no explicit example to demonstrate OpenMessage and GetMessage functions. But they are currently used by the POP3 stream handler classes that is in the same script file as the POP3 class.
Anyway, if you look near the function declarations, there are some documentation comments.
|