public Method

Mail.content_type( default = nil )

Returns the current "Content-Type" of the mail instance.

If the content_type field does not exist, returns nil by default or you can pass in as the parameter for what you want the default value to be.

Example:

mail = TMail::Mail.new
mail.content_type #=> nil
mail.content_type([]) #=> []
mail = TMail::Mail.load("../test/fixtures/raw_email")
mail.content_type #=> "text/plain"

Source Code

# File action_mailer/vendor/tmail-1.2.2/tmail/interface.rb, line 720
def content_type( default = nil )
  if h = @header['content-type']
    h.content_type || default
  else
    default
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.