aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2018-09-25 16:58:00 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-09-25 16:58:00 -0700
commit1087d70182e066d11c708b8eee43fee25ba1bc3f (patch)
tree002d73a82ee37410005ce96d1f9f675d3b77804f /lib
parent96b6e7ce669cf412f931e700fafc99d6d7ef031a (diff)
downloadrails-1087d70182e066d11c708b8eee43fee25ba1bc3f.tar.gz
rails-1087d70182e066d11c708b8eee43fee25ba1bc3f.tar.bz2
rails-1087d70182e066d11c708b8eee43fee25ba1bc3f.zip
Handle all recipients of an email as part of the routing
Diffstat (limited to 'lib')
-rw-r--r--lib/action_mailroom/router/route.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/action_mailroom/router/route.rb b/lib/action_mailroom/router/route.rb
index 316c77d711..6d0b922275 100644
--- a/lib/action_mailroom/router/route.rb
+++ b/lib/action_mailroom/router/route.rb
@@ -10,9 +10,9 @@ class ActionMailroom::Router::Route
def match?(inbound_email)
case address
when String
- inbound_email.mail.to.include?(address)
+ recipients_from(inbound_email.mail).include?(address)
when Regexp
- inbound_email.mail.to.detect { |recipient| address.match?(recipient) }
+ recipients_from(inbound_email.mail).detect { |recipient| address.match?(recipient) }
when Proc
address.call(inbound_email)
else
@@ -23,4 +23,9 @@ class ActionMailroom::Router::Route
def mailbox_class
"#{mailbox_name.to_s.capitalize}Mailbox".constantize
end
+
+ private
+ def recipients_from(mail)
+ Array(mail.to) + Array(mail.cc) + Array(mail.bcc)
+ end
end