# "Catch" mails using Rails (some sort of ticket software)?

**URL:** <https://www.ruby-forum.com/t/catch-mails-using-rails-some-sort-of-ticket-software/131633>\
**Category:** Rails\
**Created:** [March 12, 2008, 1:14am UTC](https://www.ruby-forum.com/t/catch-mails-using-rails-some-sort-of-ticket-software/131633 "2008-03-12T01:14:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [March 12, 2008, 1:14am UTC](https://www.ruby-forum.com/t/catch-mails-using-rails-some-sort-of-ticket-software/131633/1 "2008-03-12T01:14:41Z")

</div>

Hi all

I’m developing a website where DJ’s can be booked. To book a DJ, the  
user can fill out a booking request form, which is saved as a Booking  
model instance.

Now I’d like to save all correspondence (which is done through email) in  
the database, so I can later browse my old bookings and can exactly see  
what I’ve written to the requester and what he has written back.

So I wonder how I can “catch” mails using Rails?

The idea is the following:

1. The user (removed\_email\_address@domain.invalid) creates a booking request.
2. The request is saved as a Booking instance
3. A mail with the booking details is sent to my email  
(removed\_email\_address@domain.invalid) with a unique subject (e.g. Booking request #123);  
the sender of the email is removed\_email\_address@domain.invalid
4. I can reply to the email, which is catched by Rails. Rails evaluates  
the subject (e.g. Re: Booking request #123), saves the content of the  
mail into the database and forwards the mail to the user  
(removed\_email\_address@domain.invalid)
5. The user replies the same way…

Now, is this very hard to implement? Where can I find extensive  
informations about this topic?

Thanks a lot for help,  
Josh

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [March 20, 2008, 5:17pm UTC](https://www.ruby-forum.com/t/catch-mails-using-rails-some-sort-of-ticket-software/131633/2 "2008-03-20T17:17:46Z")

</div>

Nobody can point me into the right direction…?

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [March 20, 2008, 5:30pm UTC](https://www.ruby-forum.com/t/catch-mails-using-rails-some-sort-of-ticket-software/131633/3 "2008-03-20T17:30:52Z")

</div>

One approach might be to use an open source MDA that uses mysql as a  
message  
store, setup DRb to poll every 5 minutes… The benefit of this  
approach is  
that you get all the spam filtering, etc. from the MDA; wouldn’t want to  
reinvent those wheels. Polling is a drag, so if the MDA has a  
notification  
system, that would be better, and if it were ReSTful, integration w/ RoR  
would be a breeze.

Zimbra’s a pretty good one with open source option and mysql store, and  
since it’s open source, they either have good api’s for things like  
notification or you can add it yourself.

Hope this helps,

m

On Thu, Mar 20, 2008 at 9:17 AM, Joshua M. \<
