💎 Ruby on Rails
Intermediate
What is ActionMailer in Rails?
Answer
ActionMailer is the Rails component for sending emails. Mailers are classes in app/mailers/ that inherit from ApplicationMailer. Each method defines an email with mail(to:, subject:), and uses views in app/views/mailer_name/ for HTML and text templates. Send immediately: UserMailer.welcome(@user).deliver_now. Send asynchronously via ActiveJob: UserMailer.welcome(@user).deliver_later. Configure delivery in config/environments/ — use :smtp for production and :test or :letter_opener for development.