def render_mail(options = @method)
      @_missing_templates = false # used to make sure that at least one template was found
      # If the options are not a hash, normalize to an action hash
      options = {:action => {:html => options, :text => options}} if !options.is_a?(Hash)

      # Take care of the options
      opts_hash = {}
      opts = options.dup
      actions = opts.delete(:action) if opts[:action].is_a?(Hash)
      templates = opts.delete(:template) if opts[:template].is_a?(Hash)

      # Prepare the options hash for each format
      # We need to delete anything relating to the other format here
      # before we try to render the template.
      [:html, :text].each do |fmt|
        opts_hash[fmt] = opts.delete(fmt)
        opts_hash[fmt] ||= actions[fmt] if actions && actions[fmt]
        opts_hash[:template] = templates[fmt] if templates && templates[fmt]
      end

      # Send the result to the mailer
      { :html => "rawhtml=", :text => "text="}.each do |fmt,meth|
        begin
          local_opts = opts.merge(:format => fmt)
          local_opts.merge!(:layout => false) if opts_hash[fmt].is_a?(String)

          clear_content
          value = render opts_hash[fmt], local_opts
          @mail.send(meth,value) unless value.nil? || value.empty?
        rescue Merb::ControllerExceptions::TemplateNotFound => e
          # An error should be logged if no template is found instead of an error raised
          if @_missing_templates
            Merb.logger.error(e.message)
          else
            @_missing_templates = true
          end
        end
      end
      @mail
    end
def render_mail(options = @method)
      @_missing_templates = false # used to make sure that at least one template was found
      # If the options are not a hash, normalize to an action hash
      options = {:action => {:html => options, :text => options}} if !options.is_a?(Hash)

      # Take care of the options
      opts_hash = {}
      opts = options.dup
      actions = opts.delete(:action) if opts[:action].is_a?(Hash)
      templates = opts.delete(:template) if opts[:template].is_a?(Hash)

      # Prepare the options hash for each format
      # We need to delete anything relating to the other format here
      # before we try to render the template.
      [:html, :text].each do |fmt|
        opts_hash[fmt] = opts.delete(fmt)
        opts_hash[fmt] ||= actions[fmt] if actions && actions[fmt]
        opts_hash[:template] = templates[fmt] if templates && templates[fmt]
      end

      # Send the result to the mailer
      { :html => "rawhtml=", :text => "text="}.each do |fmt,meth|
        begin
          local_opts = opts.merge(:format => fmt)
          local_opts.merge!(:layout => false) if opts_hash[fmt].is_a?(String)

          clear_content
          value = render opts_hash[fmt], local_opts
          @mail.send(meth,value) unless value.nil? || value.empty?
        rescue Merb::ControllerExceptions::TemplateNotFound => e
          # An error should be logged if no template is found instead of an error raised
          if @_missing_templates
            Merb.logger.error(e.message)
          else
            @_missing_templates = true
          end
        end
      end
      @mail
    end
Allows you to render various types of things into the text and HTML parts
 of an email If you include just text, the email will be sent as
 plain-text. If you include HTML, the email will be sent as a multi-part
 email.

 ==== Parameters
 options<~to_s, Hash>::
   Options for rendering the email or an action name. See examples below
   for usage.

 ==== Examples
 There are a lot of ways to use render_mail, but it works similarly to the
 default Merb render method.

 First of all, you'll need to store email files in your
 app/mailers/views directory. They should be under a directory that
 matches the name of your mailer (e.g. TestMailer's views would be stored
 under test_mailer).

 The files themselves should be named action_name.mime_type.extension. For
 example, an erb template that should be the HTML part of the email, and
 rendered from the "foo" action would be named foo.html.erb.

 The only mime-types currently supported are "html" and "text", which
 correspond to text/html and text/plain respectively. All template systems
 supported by your app are available to MailController, and the extensions
 are the same as they are throughout the rest of Merb.

 render_mail can take any of the following option patterns:

   render_mail

 will attempt to render the current action. If the current action is
 "foo", this is identical to render_mail :foo.

   render_mail :foo

 checks for foo.html.ext and foo.text.ext and applies them as appropriate.

   render_mail :action => {:html => :foo, :text => :bar}

 checks for foo.html.ext and bar.text.ext in the view directory of the
 current controller and adds them to the mail object if found

   render_mail :template => {:html => "foo/bar", :text => "foo/baz"}

 checks for bar.html.ext and baz.text.ext in the foo directory and adds
 them to the mail object if found.

   render_mail :html => :foo, :text => :bar

 the same as render_mail :action => {html => :foo, :text => :bar }

   render_mail :html => "FOO", :text => "BAR"

 adds the text "FOO" as the html part of the email and the text "BAR" as
 the text part of the email. The difference between the last two examples
 is that symbols represent actions to render, while string represent the
 literal text to render. Note that you can use regular render methods
 instead of literal strings here, like:

   render_mail :html => render(:action => :foo)

 but you're probably better off just using render_mail :action at that
 point.

 You can also mix and match:

   render_mail :action => {:html => :foo}, :text => "BAR"

 which would be identical to:

   render_mail :html => :foo, :text => "BAR"