File: //usr/local/rvm/gems/default/doc/mail-2.7.1/ri/Mail/Message/attachments-i.ri
U:RDoc::AnyMethod[iI"attachments:ETI"Mail::Message#attachments;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"NReturns an AttachmentsList object, which holds all of the attachments in ;TI"Lthe receiver object (either the entire email or a part within) and all ;TI"of its descendants.;To:RDoc::Markup::BlankLine o;
; [I"PIt also allows you to add attachments to the mail object directly, like so:;T@o:RDoc::Markup::Verbatim; [I"Kmail.attachments['filename.jpg'] = File.read('/path/to/filename.jpg')
;T:@format0o;
; [I"XIf you do this, then Mail will take the file name and work out the MIME media type ;TI"Nset the Content-Type, Content-Disposition, Content-Transfer-Encoding and ;TI">base64 encode the contents of the attachment all for you.;T@o;
; [I"VYou can also specify overrides if you want by passing a hash instead of a string:;T@o;; [I"Mmail.attachments['filename.jpg'] = {:mime_type => 'application/x-gzip',
;TI"Y :content => File.read('/path/to/filename.jpg')}
;T;
0o;
; [I"WIf you want to use a different encoding than Base64, you can pass an encoding in, ;TI"Sbut then it is up to you to pass in the content pre-encoded, and don't expect ;TI"*Mail to know how to decode this data:;T@o;; [ I"Ffile_content = SpecialEncode(File.read('/path/to/filename.jpg'))
;TI"Mmail.attachments['filename.jpg'] = {:mime_type => 'application/x-gzip',
;TI"I :encoding => 'SpecialEncoding',
;TI"D :content => file_content }
;T;
0o;
; [I"2You can also search for specific attachments:;T@o;; [
I"# By Filename
;TI"Email.attachments['filename.jpg'] #=> Mail::Part object or nil
;TI"
;TI"# or by index
;TI"Imail.attachments[0] #=> Mail::Part (first attachment);T;
0:
@fileI"lib/mail/message.rb;T:0@omit_headings_from_table_of_contents_below000[ I"();T@8FI"Message;TcRDoc::NormalClass00