Class: CMS::FormsMailer
- Inherits:
-
Object
- Object
- CMS::FormsMailer
- Defined in:
- app/mailers/cms/forms_mailer.rb
Instance Method Summary collapse
Instance Method Details
#fix_mixed_attachments ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/mailers/cms/forms_mailer.rb', line 28 def # do nothing if we have no actual attachments return if @_message.parts.select { |p| p. && !p.inline? }.none? mail = Mail.new = Mail::Part.new .content_type = @_message.content_type @_message.parts.select { |p| !p. || p.inline? }.each { |p| .add_part(p) } mail.add_part mail.header = @_message.header.to_s mail.bcc = @_message.header[:bcc].value # copy bcc manually because it is omitted in header.to_s mail.content_type = nil @_message.parts.select { |p| p. && !p.inline? }.each { |p| mail.add_part(p) } @_message = mail wrap_delivery_behavior!(delivery_method.to_sym) end |
#send_email(form) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/mailers/cms/forms_mailer.rb', line 3 def send_email(form) = { from: form.send_from, to: form.send_to, bcc: Setting[:cms_mail_bcc], subject: form.subject, template_name: form.form_name, } if form. [:content_type] = 'multipart/form-data' form..each do |name| = form.send(name) next unless .exists? [.original_filename] = File.read(.path) end end @form = form mail # https://github.com/rails/rails/issues/2686 end |