Test Your Knowledge
Quiz
Where do you tell Rails how to send email?
How do you specify which variables fit where in a given mail message?
What additional field needs to be specified in the model to send HTML email?
Can Rails check a POP-3 inbox for messages?
Answers
The configuration files in config/environments/âdevelopment.rb, testing.rb, and production.rbâare a good place to specify the settings that Rails should use to send outgoing mail.
A model class extending
ActionMailer::Base
containing a method that sets email parameters can handle all of the header information for email messages, and a view can define their content.To send HTML email, the
content_type
must be set totext/html
for simple HTML email, or tomultipart/alternative
for messages containing images, stylesheets, or other contents beyond the HTML.Yes, Rails can check a mailbox to see whether anything has come in, and retrieve and process messages.
Get Learning Rails now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.