On 2/2/07, David Uzzell
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> Hi
>
> I have a rails app that receives email and displays their bodies on a
> single web page. My problem is that some of the emails are plain text
> and others are HTML. The bodies of the HTML emails are displayed in
> their textareas with all of the embedded HTML markup visible.
>
> I''d like to render the bodies before I display each in its
textarea, or
> strip the markup out and simply dispay the content. I think
> render_to_string() might do the trick, but it''s a Controller
method and
> I think I need it in either the ActionMailer when I''m reading the
email
> or in the View when I''m displaying the email.
>
> Is there an existing way to render the HTML or strip out the markup when
> I am importing the email or when I am displaying the email bodies?
>
> Thanks
>
> David
I''d be very careful displaying HTML that you don''t generate.
It is
trivial to embed javascript sniffers and other goodies that could
endanger your app. Check out the white_list plugin which allows
stripping certain html tags:
http://svn.techno-weenie.net/projects/plugins/white_list
Hope this helps.
--
Zack Chandler
http://depixelate.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---