Sha256: f5264178576149768f238e910523ac6a6ed3eaa64fc41634d8f1f47df3522cae

Contents?: true

Size: 1.17 KB

Versions: 13

Compression:

Stored size: 1.17 KB

Contents

module MList
  module Manager
    
    # Constructs the notices that are sent to list subscribers. Applications
    # may subclass this to customize the content of a notice delivery.
    #
    class Notifier
      
      # Answers the delivery that will be sent to a subscriber when an
      # MList::List indicates that the distribution of an email from that
      # subscriber has been blocked.
      #
      def subscriber_blocked(list, email, subscriber)
        delivery = MList::Util::TMailBuilder.new(TMail::Mail.new)
        delivery.write_header('x-mlist-loop', 'notice')
        delivery.write_header('x-mlist-notice', 'subscriber_blocked')
        delivery.to = subscriber.email_address
        delivery.from = "mlist-#{list.address}"
        prepare_subscriber_blocked_content(list, email, subscriber, delivery)
        delivery
      end
      
      protected
        def prepare_subscriber_blocked_content(list, email, subscriber, delivery)
          delivery.set_content_type('text/plain')
          delivery.body = %{Although you are a subscriber to this list, your message cannot be posted at this time. Please contact the administrator of the list.}
        end
    end
    
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
aiwilliams-mlist-0.1.5 lib/mlist/manager/notifier.rb
aiwilliams-mlist-0.1.6 lib/mlist/manager/notifier.rb
aiwilliams-mlist-0.1.7 lib/mlist/manager/notifier.rb
aiwilliams-mlist-0.1.8 lib/mlist/manager/notifier.rb
mlist-0.1.18 lib/mlist/manager/notifier.rb
mlist-0.1.17 lib/mlist/manager/notifier.rb
mlist-0.1.16 lib/mlist/manager/notifier.rb
mlist-0.1.14 lib/mlist/manager/notifier.rb
mlist-0.1.13 lib/mlist/manager/notifier.rb
mlist-0.1.12 lib/mlist/manager/notifier.rb
mlist-0.1.11 lib/mlist/manager/notifier.rb
mlist-0.1.10 lib/mlist/manager/notifier.rb
mlist-0.1.9 lib/mlist/manager/notifier.rb