[RCD] rcube_message get_header returns empty string

Julien Vehent julien at linuxwall.info
Mon Feb 7 23:54:37 CET 2011


On 02/07/2011 05:14 PM, Julien Vehent wrote:
> 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:
>

I did something equivalent based on the raw messages and a regex, but 
that's kind of heavy to get just one header....

I anybody has a more elegant solution, I'm up for it !

------
$raw_message = $rcmail->imap->get_raw_body($uid);
preg_match("/X-DSPAM-Signature: (.*)/i",$raw_message, $match);
$dspam_signature = $match[1];
$command = str_replace('%s', $dspam_signature,$command);
------

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



More information about the Dev mailing list