MailboxerMultiAttach

This project rocks and uses MIT-LICENSE.

Install

Project is for Rails 3.2.2 at the moment! Add to your gemfile and run the following

    rails g mailboxer_multi_attach:install
    bundle exec rake db:migrate

Usage

On any messageable object you utilize send_message_mult_attach, reply_to_sender_mult_attach, or reply_to_convo_mult_attach to send messages. Once the message is sent you can access the attachments by calling message_attachments on the messageable model's message. The following works where the entity has the messageable reference on its model. Make sure to use the key :file when submitting the attachment!

    attachments = [{ :file => File.open('spec/testfile.txt') }, { :file => File.open('spec/1.mp4') }]
    receipt = entity1.send_message_mult_attach(entity2, "Body", "Subject", true, attachments)
    entity2.reply_to_sender_mult_attach(receipt, "Body", "Subject", true, attachments)
    entity2.reply_to_convo_mult_attach(receipt.conversation, "Body", "Subject", true, attachments)

You can also not pass in attachments like the following.

    entity1.send_message_mult_attach(entity2, "Body", "Subject", true)

TODO

  • reply_to method for conversations