Roundcube Community Forum

 

How to get message headers from plugin in 'message_sent' hook

Started by bakhtiyor, November 03, 2011, 04:26:48 PM

Previous topic - Next topic

bakhtiyor

Hi.

I am going to implement a plugin in order to send SMS when the user send an email. So, first of all I need to know how to get headers.Here is the draft version of my plugin:


class sendsms extends rcube_plugin{

   function 
init(){     
        
$this->add_hook('message_sent',array($this, 'sms_notification'));        
   }

   function 
sms_notification($args){
        
$fp = fopen('test/data.txt', 'w');
        
fwrite($fp, "1 \n");
        
fwrite($fp, "23 \n");
        
fwrite($fp, "45 \n");
        
$test="TO: ".$args;
        
fwrite($ftp, $test);  // this line is not printing anything in the file
        
$test2=$args['headers']['To'];
        
fwrite($ftp, $test2); // this line also is not printing anything in the file
        
fclose($fp);
    }

}


I don't know why but $args['headers']['To'] is not returning anything, why? Any help would be appreciated.

Thank you