Skip to content

Instantly share code, notes, and snippets.

@mlangenberg
Created August 27, 2008 09:44
Show Gist options
  • Save mlangenberg/7452 to your computer and use it in GitHub Desktop.
Save mlangenberg/7452 to your computer and use it in GitHub Desktop.
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' })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment