diff options
author | Lachlan Sylvester <lachlan.sylvester@hypothetical.com.au> | 2019-01-07 09:05:39 +1100 |
---|---|---|
committer | Lachlan Sylvester <lachlan.sylvester@hypothetical.com.au> | 2019-01-07 10:56:41 +1100 |
commit | 0419bc35047a62286961feb6e3e0177c9aa18cfa (patch) | |
tree | 8df66e792e1e71696f75980c8b0908e678e24327 /actionmailbox/app/controllers | |
parent | 1e09019088760adafaa122eb11c24effdb4c1160 (diff) | |
download | rails-0419bc35047a62286961feb6e3e0177c9aa18cfa.tar.gz rails-0419bc35047a62286961feb6e3e0177c9aa18cfa.tar.bz2 rails-0419bc35047a62286961feb6e3e0177c9aa18cfa.zip |
add attachments to the new inbound mail
Diffstat (limited to 'actionmailbox/app/controllers')
-rw-r--r-- | actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb b/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb index 30d6afe0c0..3537a983ef 100644 --- a/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb +++ b/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb @@ -20,7 +20,11 @@ module Rails private def new_mail - Mail.new params.require(:mail).permit(:from, :to, :cc, :bcc, :in_reply_to, :subject, :body).to_h + Mail.new(params.require(:mail).permit(:from, :to, :cc, :bcc, :in_reply_to, :subject, :body).to_h).tap do |mail| + params[:mail][:attachments].to_a.each do |attachment| + mail.attachments[attachment.original_filename] = { filename: attachment.path, content_type: attachment.content_type } + end + end end def create_inbound_email(mail) |