0

I've naive customers who will need to copy the HTML part of email in Outlook. So I want them to copy and paste the HTML source of the email which includes <html> <body> </body> </html>.

Is there any filter which will remove all but keep only the content within the <body> part?

2 Answers 2

0

Drupal's text format has an option for "Limit allowed HTML tags," in which you can specify which tags you would like to keep. You could always create a list of tags you use in your emails. If you exclude the html and body tags, that might work for you.

Another option is you can simply write your own text filter. You'll need to implement hook_filter_info.

Basiclly you would want something like:

function my_module_filter_info() {
  $filters['filter_name'] = array(
    'title' => t('Some Nice Filter Name'),
    'description' => t('Filter out stuff'),
    'process callback' => "your_filter_function",
    'cache' => FALSE,
   );
   return $filters;
  }

Then it's just a issue of writing your filter function.

function your_filter_function($body_text){
   //do stuff to your body_text to remove the tags you want to remove
   return $body_text
}
0

Oh it automatically filters out if we copy the whole html starting from <html> tag. So we don't need to do anything

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.