[RCD] rcube_message get_header returns empty string

Julien Vehent julien at linuxwall.info
Mon Feb 7 23:14:45 CET 2011


Hi list,

I'm having issues with a custom dev for markasjunk2 plugin.
I want to access the header X-DSPAM-Signature using the following code:

------
// get dspam signature header (%s macro)
if(preg_match("/%s/",$command)){
     $MESSAGE = new rcube_message($uid);
     $dspam_signature = $MESSAGE->get_header('x-dspam-signature');
     file_put_contents('/tmp/mark_dspam', "uid=$uid; 
signature=$dspam_signature\n");
     $command = str_replace('%s', $dspam_signature,$command);
}
------

And all I get is an empty string instead of the header's value:

------
# cat /tmp/mark_dspam
uid=25; signature=
------

If I try to fetch the header 'subject' instead of x-dspam-signature, it 
works alright.

In the email, this header is present :

------
Date: Mon, 07 Feb 2011 15:16:48 -0500
From: Julien...
User-Agent: Mozilla...
MIME-Version: 1.0
To: julien...
Subject: spam
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-DSPAM-Result: Innocent
X-DSPAM-Processed: Mon Feb  7 21:16:55 2011
X-DSPAM-Confidence: 0.9899
X-DSPAM-Improbability: 1 in 9809 chance of being spam
X-DSPAM-Probability: 0.0000
X-DSPAM-Signature: 4d50533749761795657448
------

I can't use the imap_init hook because the code is located in the 
'cmd_learn.php' driver and not in the main function (it's on purpose).

How can I access this header ?

Thanks,
julien

_______________________________________________
List info: http://lists.roundcube.net/dev/
BT/aba52c80



More information about the Dev mailing list