aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailbox
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2019-06-20 14:09:01 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2019-06-20 14:09:01 +0900
commitaab9f6734d1027ee5ee49c150f3e7b264e801a82 (patch)
tree848296ebbb5e840c7cff680c3347c62e1ec61ca6 /actionmailbox
parentbf625f7fecabbcda22b388e088ad5c29016b2385 (diff)
downloadrails-aab9f6734d1027ee5ee49c150f3e7b264e801a82.tar.gz
rails-aab9f6734d1027ee5ee49c150f3e7b264e801a82.tar.bz2
rails-aab9f6734d1027ee5ee49c150f3e7b264e801a82.zip
Include BCC in the mail that sent from the development page
The BCC should be included as we show input field for BCC in view. https://github.com/rails/rails/blob/bf625f7fecabbcda22b388e088ad5c29016b2385/actionmailbox/app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erb#L21-L24
Diffstat (limited to 'actionmailbox')
-rw-r--r--actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb1
-rw-r--r--actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb2
2 files changed, 3 insertions, 0 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 d051dfe665..8713f545f5 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
@@ -21,6 +21,7 @@ module Rails
private
def new_mail
Mail.new(params.require(:mail).permit(:from, :to, :cc, :bcc, :in_reply_to, :subject, :body).to_h).tap do |mail|
+ mail[:bcc]&.include_in_headers = true
params[:mail][:attachments].to_a.each do |attachment|
mail.add_file(filename: attachment.path, content: attachment.read)
end
diff --git a/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb b/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb
index fcd9ad839f..1b8ca7bd5e 100644
--- a/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb
+++ b/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb
@@ -10,6 +10,7 @@ class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispa
mail: {
from: "Jason Fried <jason@37signals.com>",
to: "Replies <replies@example.com>",
+ bcc: "Bcc <bcc@example.com>",
in_reply_to: "<4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>",
subject: "Hey there",
body: "How's it going?"
@@ -20,6 +21,7 @@ class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispa
mail = ActionMailbox::InboundEmail.last.mail
assert_equal %w[ jason@37signals.com ], mail.from
assert_equal %w[ replies@example.com ], mail.to
+ assert_equal %w[ bcc@example.com ], mail.bcc
assert_equal "4e6e35f5a38b4_479f13bb90078178@small-app-01.mail", mail.in_reply_to
assert_equal "Hey there", mail.subject
assert_equal "How's it going?", mail.body.decoded