| Module | Sergi::Acts::Messageable::InstanceMethods |
| In: |
lib/acts_as_messageable.rb
|
Adds instance methods.
returns an instance of class type Mailbox - this object essentially wraps the user‘s mail messages and provides a clean interface for accessing them. see Mailbox for more details.
phil = User.find(3123) phil.mailbox[:inbox].unread_mail #returns all unread mail in your inbox phil.mailbox[:sentbox].mail #returns all sent mail messages
returns an array of the user‘s Mail associated with the given conversation. All mail is marked as read but the returning array is built before this so you can see which messages were unread when viewing the conversation.
This returns deleted/trashed messages as well for the purpose of reading trashed convos, to disable this send the option ’:conditions => "mail.trashed != true"’
| conversation: | the Conversation object that you want to read. |
| options: | any options to filter the conversation, these are used as find options so all valid options for find will work. |
array of Mail belonging to the given conversation.
creates a new Message associated with the given conversation and delivers the reply to each of the given recipients.
*explicitly calling this method is rare unless you are replying to a subset of the users involved in the conversation or if you are including someone that is not currently in the conversation. reply_to_sender, reply_to_all, and reply_to_conversation will suffice in most cases.
| conversation: | the Conversation object that the mail you are responding to belongs. |
| recipients: | a single User object or array of Users to deliver the reply message to. |
| reply_body: | the body of the reply message. |
| subject: | the subject of the message, defaults to ‘RE: [original subject]’ if one isnt given. |
the sent Mail.
sends a Mail to all users involved in the given conversation (excluding yourself).
*this may have undesired effects if users have been added to the conversation after it has begun.
| conversation: | the Conversation object that the mail you are responding to belongs. |
| reply_body: | the body of the reply message. |
| subject: | the subject of the message, defaults to ‘RE: [original subject]’ if one isnt given. |
the sent Mail.
creates new Message and Conversation objects from the given parameters and delivers Mail to each of the recipients’ inbox.
| recipients: | a single user object or array of users to deliver the message to. |
| msg_body: | the body of the message. |
| subject: | the subject of the message, defaults to empty string if not provided. |
the sent Mail.
phil = User.find(3123) todd = User.find(4141) phil.send_message(todd, 'whats up for tonight?', 'hey guy') #sends a Mail message to todd's inbox, and a Mail message to phil's sentbox