method

create_mail

Importance_0
v1.0.0 - Show latest stable - 0 notes - Class: ActionMailer::Base
create_mail() private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionmailer/lib/action_mailer/base.rb, line 397
      def create_mail
        m = TMail::Mail.new

        m.subject, = quote_any_if_necessary(charset, subject)
        m.to, m.from = quote_any_address_if_necessary(charset, recipients, from)
        m.bcc = quote_address_if_necessary(bcc, charset) unless bcc.nil?
        m.cc  = quote_address_if_necessary(cc, charset) unless cc.nil?

        m.mime_version = mime_version unless mime_version.nil?
        m.date = sent_on.to_time rescue sent_on if sent_on
        headers.each { |k, v| m[k] = v }

        if @parts.empty?
          m.set_content_type content_type, nil, { "charset" => charset }
          m.body = Utils.normalize_new_lines(body)
        else
          if String === body
            part = TMail::Mail.new
            part.body = Utils.normalize_new_lines(body)
            part.set_content_type content_type, nil, { "charset" => charset }
            part.set_content_disposition "inline"
            m.parts << part
          end

          @parts.each do |p|
            part = (TMail::Mail === p ? p : p.to_mail(self))
            m.parts << part
          end
          
          m.set_content_type(content_type, nil, { "charset" => charset }) if content_type =~ /multipart/
        end

        @mail = m
      end
Register or log in to add new notes.