Attraction Mailbox - Why I love Action Mailbox, by Cody Norman

Intended Audience

This talk is for anyone wanting to learn more about receiving inbound emails for their Rails application.

Outcomes

After attending this talk, audience members should be able to:

  1. Install and configure Action Mailbox
  2. Routing Inbound Emails to their correct Mailbox
  3. Send and test mails locally
  4. Deploy to a Email Service Provider
  5. Learn common pitfalls and how to debug production issues

Outline

Intro
  • Benefits of allowing inbound emails
  • Examples of some things you can do with allowing inbound emails (ex: github - reply to email to get added to PR, reply to email to add new comment)
  • What is Action Mailbox
  • Built in Ingresses
Getting Started
  • Run generator to install
  • ApplicationMailbox routes the email to a specific mailbox
  • Talk about routes and using things like :all
Rails Conductor
  • Sending an email from the Rails Conductor
  • Getting and using .eml for sending with source
  • Sending Attachments
What happens when an email is received
  • ActiveStorage used for processing (gotchas - just use s3)
  • ActiveJob processing and incinerating inbound emails
  • Routing an email to a mailbox (regex captures and other methods)
  • Email routes will return the first match (source code)
  • Using a catch-all mailbox or route
The ActionMailbox::InboundEmail class
  • Review ActionMailbox::InboundEmail
  • Review raw_email attachment
  • Show how a Mail object is created from the original email from Active Storage
Mailboxes
  • Parsing Attachments
  • Processing Mail with the Ruby Mail Object
  • Why the email being processed in a background job can cause hiccups
Running in Production
  • mail ingress options
  • Example configuration and setup for a default ingress (Postmark)
  • Getting email source from production
  • Uploading an email from source in the conductor and reprocessing
  • using a subdomain like inbound.yourdomain.com can help keep things separate

Pitch

I wouldn’t say I’m in love with Email, more like I’m in love with the idea of email. I think email is a great tool to incorporate into your application. I’ve also really enjoyed the idea of pretty much any regular person off the street could interact with your application without having to even load it in their browser.

I think Action Mailbox is a vastly under-rated part of the Rails ecosystem. I would love to highlight how easy it can be adding a whole new communication channel into your app in a comfortable and familiar ‘Rails’ way.

Edit proposal

Submissions

Add submission