Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActionMailer::Base.perform_deliveries to accept a proc

#1217

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$/}

Reported by Darragh Curran · October 15th, 2008 @ 02:41 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Pratik
    Pratik

    If http://www.elevatedrails.com/art... works for you, we can close this ticket ?

    Thanks.

    October 16th, 2008 @ 02:12 PM

  2. Darragh Curran
    Darragh Curran

    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

    October 16th, 2008 @ 03:33 PM

  3. Pratik
    Pratik
    • State changed from new to wontfix

    October 16th, 2008 @ 03:36 PM

  4. Pratik
    Pratik

    We can reevaluate if there's more ineterest in this.

    Thanks.

    October 16th, 2008 @ 03:36 PM