Block email sending to certain email addresses or domain in ruby on rails?

If you want to block email sending to some particular user or some specific email format, then interceptor is your friend :) Just place this code in your config/initializers/email_filters.rb

  class EmailAddressFilter
    def self.delivering_email(message)
      message.perform_deliveries = false

      # your checks here; return if, etc.. is matched
      return unless"").match(/

      # otherwise, the email should be sent
      message.perform_deliveries = true


All of your emails will be blocked matching that regex :)