Coding with smile

Send Email With Merb-mailer in Datamapper Model

With Merb-mailer, merb offer a system to send email. But merb is a web framework ORM agnostic. So merb-mailer is like a controller, not a model like in Rails. So the send_mail method is available only in controller. But how use this method in our Datamapper model? It's really simple because Merb use the good way in Ruby and help to use that.

After a short research in code of merb-mailer. I look that the send_mail method is in Mixin. After include this mixin in your class, you can use the send_mail method.