ActionMailer makes it easy to attach files to your emails. In this article, I show you how to attach single or multiple files, set custom encodings and mime_types, and attach images as inline attachments to display in your email body.
This article covers everything you ever wanted to know (and more) about previewing emails and ActionMailer templates in Ruby on Rails. I cover native ActionMailer previews, the letter_opener gem, MailCatcher and MailHog. I've tested them all, and I cover how to use them, and their pros and cons.
How I switched from using direct SendGrid API calls to implementing ActionMailer for cleaner, more manageable code. Our final implementation will take us from 36 lines of code, down to 1 ...