Skip to content

Instantly share code, notes, and snippets.

@DAddYE
Created April 28, 2010 16:40
Show Gist options
  • Save DAddYE/382354 to your computer and use it in GitHub Desktop.
Save DAddYE/382354 to your computer and use it in GitHub Desktop.
MyApp.mailer :notifier do
deafult :from => "[email protected]"
email :registration do |name, surname, email|
to email
subject "Registration"
content_type "text/plain"
body render('notifier/registration')
end
email :comment do |account, post|
to Account.administrators_emails
subject "New comment on #{post.title}"
body render('comments/preview', :layout => false)
end
end
class MyApp < Padrino::Application
mailer :accounts do
deafult :from => "[email protected]"
email :signup do |name, surname, email|
to email
subject "Registration"
content_type "text/plain"
body render('notifier/registration')
end
end
contoller :accounts do
post :signup do
@account = Account.create(params[:account])
...
Mailer.deliver(:accounts, :signup, :name => account.name, :surname => account.surname, :email => account.email)
end
end
end
@achiurizo
Copy link

this looks pretty clean

@nesquena
Copy link

Check out the issue for the work I have done to support this syntax with a nice dsl layer over the existing system: http://github.com/padrino/padrino-framework/issues/#issue/127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment