Author Topic: Change MIME Header  (Read 4303 times)

Offline washburn

  • Newbie
  • *
  • Posts: 3
Change MIME Header
« on: April 25, 2015, 09:59:25 AM »
Hello,

I work on a small plugin which modifiy a written email. However, I cannot modify header information. This is what I tried:
Code: [Select]
<?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

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Change MIME Header
« Reply #1 on: April 25, 2015, 06:42:03 PM »

Offline washburn

  • Newbie
  • *
  • Posts: 3
Re: Change MIME Header
« Reply #2 on: April 26, 2015, 11:13:09 AM »
This is exactly what I wanted, works!

Code: [Select]
<?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;
  }
}