mlangenberg (owner)

Revisions

gist: 7452 Download_button fork
public
Public Clone URL: git://gist.github.com/7452.git
Embed All Files: show embed
merb_mailer.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'rubygems'
require 'merb-core'
 
module Merb
  class Mailer
    class_inheritable_accessor :config
    def initialize(opts = {})
      self.config = {:sendmail_path => '/usr/sbin/sendmail'} if config.nil?
    end
  end
  
  class MailController
    class_inheritable_accessor :_mailer_klass
    self._mailer_klass = Merb::Mailer
        
    def initialize(opts = {})
    end
    
    def dispatch_and_deliver(methoc, mail_params)
      @mailer = self.class._mailer_klass.new(mail_params)
    end
  end
end
 
 
class FormMailer < Merb::MailController
  def notification
  end
end
 
FormMailer.new({:foo => :bar}).dispatch_and_deliver(:blabla, {:to => 'mlangenberg@gmail.com' })