Roundcube Community Forum

 

Change MIME Header

Started by washburn, April 25, 2015, 09:59:25 AM

Previous topic - Next topic

washburn

Hello,

I work on a small plugin which modifiy a written email. However, I cannot modify header information. This is what I tried:

<?php
class smime extends rcube_plugin
{
  function 
init()
  {
    
$this->add_hook('message_before_send', array($this'change_header'));
  }
   function 
change_header($args) {
  
$rcmail rcmail::get_instance();
  
$headers $args['message']->headers();
$headers['Content-Type'] = "text/html; charset=US-ASCII;"
$args['message']->headers($headers);
        return 
$args;
  }
}


This code snippet should change Content-Type of a message to "text/html". However, when writing emails they are still from type "text/plain".
I'd really appreciate if someone could help me with that.

Regards

SKaero


washburn

This is exactly what I wanted, works!


<?php
class smime extends rcube_plugin
{
  function 
init()
  {
    
$this->add_hook('message_outgoing_headers', array($this'change_header'));
  }
   function 
change_header($args) {
  
$rcmail rcmail::get_instance();
  
$args['headers']['Content-Type'] = "text/html; charset=US-ASCII;"
        
return $args;
  }
}