Mailboxer
This project is based on the need of a private message system for ging / social_stream. Instead of creating our core message system heavily dependent on our development we are trying to implement a generic and potent messaging gem.
It is born from the great, but old, code from lpsergi / acts_as_messageable.
There is a lack of documentaion and it will be solved as soon as the gem is more stable and had proved to be useful integrated with SocialStream.
Installation
Add to your Gemfile:
gem 'mailboxer'
Then run:
bundle update
Run install script:
rails g mailboxer:install
And don’t forget to migrate you database:
rake db:migrate
Requirements
We are now adding support for sending emails when a Notification or a Message is sent to one o more recipients. So that, we mus assure that Messageable models have some specific methods. This methods are:
#Returning any kind of indentification you want for the model
def name
return "You should add method :name in your Messageable model"
end
#Returning the email address of the model
def email
return "define_email@on_your.model"
end
#Returning whether an email should be sent for this object (Message or Notification)
def should_email?(object)
return true
end
If these methods are not present, default ones will be created (the ones above).
Usage
In your model:
class User < ActiveRecord::Base
end