File: //usr/local/rvm/gems/default/doc/mail-2.7.1/ri/Mail/Message/add_file-i.ri
U:RDoc::AnyMethod[iI"
add_file:ETI"Mail::Message#add_file;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"QAdds a file to the message. You have two options with this method, you can ;TI"Vjust pass in the absolute path to the file you want and Mail will read the file, ;TI"Vget the filename from the path you pass in and guess the MIME media type, or you ;TI"Rcan pass in the filename as a string, and pass in the file content as a blob.;To:RDoc::Markup::BlankLine o;
; [I"
Example:;T@o:RDoc::Markup::Verbatim; [
I"m = Mail.new
;TI")m.add_file('/path/to/filename.png')
;TI"
;TI"m = Mail.new
;TI"Ym.add_file(:filename => 'filename.png', :content => File.read('/path/to/file.jpg'))
;T:@format0o;
; [I"]Note also that if you add a file to an existing message, Mail will convert that message ;TI"Zto a MIME multipart email, moving whatever plain text body you had into its own text ;TI"plain part.;T@o;
; [I"
Example:;T@o;; [
I"m = Mail.new do
;TI" body 'this is some text'
;TI" end
;TI"m.multipart? #=> false
;TI")m.add_file('/path/to/filename.png')
;TI"m.multipart? #=> true
;TI">m.parts.first.content_type.content_type #=> 'text/plain'
;TI"<m.parts.last.content_type.content_type #=> 'image/png'
;T;
0o;
; [I"See also #attachments;T:
@fileI"lib/mail/message.rb;T:0@omit_headings_from_table_of_contents_below000[ I"
(values);T@1FI"Message;TcRDoc::NormalClass00