Test Your Knowledge

Quiz

  1. Where do you tell Rails how to send email?

  2. How do you specify which variables fit where in a given mail message?

  3. What additional field needs to be specified in the model to send HTML email?

  4. Can Rails check a POP-3 inbox for messages?

Answers

  1. 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.

  2. 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.

  3. To send HTML email, the content_type must be set to text/html for simple HTML email, or to multipart/alternative for messages containing images, stylesheets, or other contents beyond the HTML.

  4. Yes, Rails can check a mailbox to see whether anything has come in, and retrieve and process messages.

Get Learning Rails: Live Edition 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.