diff options
author | George Claghorn <george.claghorn@gmail.com> | 2019-01-06 20:09:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-06 20:09:51 -0500 |
commit | 9cfcc067e626f0f1e220cc00a9f96622a936350d (patch) | |
tree | 8df66e792e1e71696f75980c8b0908e678e24327 /actionmailbox/app | |
parent | 1e09019088760adafaa122eb11c24effdb4c1160 (diff) | |
parent | 0419bc35047a62286961feb6e3e0177c9aa18cfa (diff) | |
download | rails-9cfcc067e626f0f1e220cc00a9f96622a936350d.tar.gz rails-9cfcc067e626f0f1e220cc00a9f96622a936350d.tar.bz2 rails-9cfcc067e626f0f1e220cc00a9f96622a936350d.zip |
Merge pull request #34886 from lsylvester/attachments-for-actionmailbox
add attachments to the new inbound mail
Diffstat (limited to 'actionmailbox/app')
-rw-r--r-- | actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb | 6 | ||||
-rw-r--r-- | actionmailbox/app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erb | 5 |
2 files changed, 10 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) diff --git a/actionmailbox/app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erb b/actionmailbox/app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erb index 7f1ec74496..a3c3d39064 100644 --- a/actionmailbox/app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erb +++ b/actionmailbox/app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erb @@ -38,5 +38,10 @@ <%= form.text_area :body, size: "40x20" %> </div> + <div> + <%= form.label :attachments, "Attachments" %><br> + <%= form.file_field :attachments, multiple: true %> + </div> + <%= form.submit "Deliver inbound email" %> <% end %> |