File: //usr/local/rvm/gems/ruby-2.5.9/doc/actionmailer-6.1.4.1/ri/ActionMailer/Base/attachments-i.ri
U:RDoc::AnyMethod[iI"attachments:ETI"#ActionMailer::Base#attachments;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"8Allows you to add attachments to an email, like so:;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"Kmail.attachments['filename.jpg'] = File.read('/path/to/filename.jpg')
;T:@format0o;
; [I"SIf you do this, then Mail will take the file name and work out the mime type. ;TI"WIt will also set the Content-Type, Content-Disposition, Content-Transfer-Encoding ;TI"9and encode the contents of the attachment in Base64.;T@o;
; [I"VYou can also specify overrides if you want by passing a hash instead of a string:;T@o;; [I"Hmail.attachments['filename.jpg'] = {mime_type: 'application/gzip',
;TI"V content: File.read('/path/to/filename.jpg')}
;T;
0o;
; [I"WIf you want to use encoding other than Base64 then you will need to pass encoding ;TI"Ttype along with the pre-encoded content as Mail doesn't know how to decode the ;TI"
data:;T@o;; [ I"Ffile_content = SpecialEncode(File.read('/path/to/filename.jpg'))
;TI"Hmail.attachments['filename.jpg'] = {mime_type: 'application/gzip',
;TI"F encoding: 'SpecialEncoding',
;TI"A content: file_content }
;T;
0o;
; [I"2You can also search for specific attachments:;T@o;; [
I"# By Filename
;TI"Fmail.attachments['filename.jpg'] # => Mail::Part object or nil
;TI"
;TI"# or by index
;TI"Jmail.attachments[0] # => Mail::Part (first attachment);T;
0:
@fileI"lib/action_mailer/base.rb;T:0@omit_headings_from_table_of_contents_below000[ I"();T@3FI" Base;TcRDoc::NormalClass00