This project is archived and is in readonly mode.
ActionMailer::Base.perform_deliveries to accept a proc
Reported by Darragh Curran | October 15th, 2008 @ 02:41 PM | in 2.x
Here's a patch so that ActionMailer::Base.perform_deliveries will accept a proc -
currently it expects a boolean -
I wanted to easily perform deliveries conditionally in my staging environment - only sending mails where recipient is in certain domain. I can achieve this with a quick but brittle monkey patch.
ActionMailer::Base.perform_deliveries = lambda {|mail| mail.header['to'].to_s =~ /@example.com$/}
Comments and changes to this ticket
-
Pratik October 16th, 2008 @ 02:12 PM
If http://www.elevatedrails.com/art... works for you, we can close this ticket ?
Thanks.
-
Darragh Curran October 16th, 2008 @ 03:33 PM
Yep Mike's suggestion works - as does what I do currently
class ActionMailer::Base def perform_deliveries
@mail.header['to'].to_s =~ /@example.com$/
end end
If you don't think it's a worthwhile change then please close the ticket,
Cheers, Darragh
-
Pratik October 16th, 2008 @ 03:36 PM
- State changed from new to wontfix
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>