Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8619235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:17:37+00:00 2026-06-12T06:17:37+00:00

I have ActionMailer configured to send emails through gmail in development mode. config/development.rb config.action_mailer.default_url_options

  • 0

I have ActionMailer configured to send emails through gmail in development mode.

config/development.rb

config.action_mailer.default_url_options = { host: ENV["MY_DOMAIN"] }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
  address: "smtp.gmail.com",
  port: 587,
  domain: ENV["MY_DOMAIN"],
  authentication: "plain",
  enable_starttls_auto: true,
  user_name: ENV["MY_USERNAME"],
  password: ENV["MY_PASSWORD"]
}

I have this set up so my designer can trigger and send test html emails to a designated address for testing in a variety of browsers / devices.

However, in development mode, I’d like to block all outgoing emails that are not being sent to that one designated email address.

I’m looking for something like:

config.action_mailer.perform_deliveries = target_is_designated_email_address?

… but I need someway to inspect the Mail instance, to ensure that it’s being sent to the correct address.

any ideas?

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:17:38+00:00Added an answer on June 12, 2026 at 6:17 am

    Check out the Mail interceptors in the mail gem that ActionMailer uses. You can find out more about them in this railscast on ActionMailer.

    The relevant part straight from the railscast:

    Create a class to redirect mail.

    class DevelopmentMailInterceptor
      def self.delivering_email(message)
        message.subject = "[#{message.to}] #{message.subject}"
        message.to = "eifion@asciicasts.com"
      end
    end
    

    Register the interceptor in development mode only:

    Mail.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
    

    Then it will just replace the subject line with “[youremail@blahbalh.com] Some subject” and redirect the message to whomever you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of customers that I send emails using an ActionMailer mailer.
I have a Rails app (2.3.8) where I send emails using ActionMailer from my
I managed to configure ActionMailer on my local machine to send emails via Gmail.
Whenever I send out emails in development mode, it does not put the localhost:3000
Are these two lines equivalent: ActionMailer::Base.smtp_settings = { config.action_mailer.smtp_settings ={ I'm trying to configure
I have an ActionMailer controller that's supposed to send this file: /user_mailer/welcome_email.text.erb This is
in my ActionMailer config file I have this: ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = {
Appname::Application.configure do config.action_mailer.delivery_method = :smtp #typical smtp_settings for gmail account config.action_mailer.smtp_settings = { :address
I have mailer: class AdminMailer < ActionMailer::Base default :from => pejottest@gmail.com def message mail(:to
assert !ActionMailer::Base.deliveries.empty?, Queue is empty If I have two unit tests that send mail,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.