Once you start sending HTML email, odds are good that you’ll want to start sending pretty HTML email, complete with graphics. You can include HTML links to resources on your site, but many mail programs block those, because they’re potential violations of privacy. Instead, it often makes more sense to send the graphics as part of the email message, as a multipart attachment.
There are fewer and fewer people who deeply object to HTML email, but there are still a lot of people who get annoyed by huge messages that take a long time to download. If you wouldn’t feel comfortable sending a message to a relative on dial-up, you probably shouldn’t send it to anyone, unless they’ve specifically requested something they know is large.
ActionMailer can handle most of the logistics for this, using the same tools shown earlier, but it needs one additional library to make it work. From the command line, or the Heroku Gems & Plugins Manager, add the InlineAttachment gem:
gem install InlineAttachment
One of the nicer features of multipart email is that it can
include a plain-text version as well as HTML and graphics, so app/views/awards/show.html.erb can revert to
the checkbox-free version shown earlier in Example 17-5. Similarly,
longer needs to evaluate the checkbox, app/controllers/awards_controller.rb can
revert to the version shown in Example 17-2. (The code for this
example is in ch17/students012.)
Most of the work needed to send ...