Iteration L2: Storing Support Requests from Our Mailbox

As we mentioned above, the purpose of mailboxes is to allow us to execute code on every email we receive. Because emails come in whenever the sender sends them, we’ll need to store the details of a customer support request somewhere for an administrator to handle later. To that end, we’ll create a new model called SupportRequest that will hold the relevant details of the request, and have the process method of SupportMailbox create an instance for each email we get (in the final section of this chapter we’ll display these in a UI so an admin can respond).

Creating a Model for Support Requests

We want our model to hold the sender’s email, the subject and body of the email, as well as a ...

Get Agile Web Development with Rails 6 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.