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 8060685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:04:33+00:00 2026-06-05T10:04:33+00:00

Newly signed up users to my little app must be approved by the admin

  • 0

Newly signed up users to my little app must be approved by the admin (me) before they can gain access to the site. I’ve succeeded in generating such emails in development with an after_create :send_admin_email in my user model which works great. My problem is that I’m generating multiple users during my tests (using FactoryGirl) and each test user created sends off a real email. Running my tests is like pouring molasses in January and I’ve got to delete hundreds of emails sent to my inbox. How do I turn that off?

Action Mailer Basics in the Rails Guides tells me that “By default Action Mailer does not send emails in the test environment. They are just added to the ActionMailer::Base.deliveries array.”

Moreover, in config/environments/test.rb I’ve got:

config.action_mailer.delivery_method = :test

That’s in addition to in config/environment.rb having:

# Configuration for using SendGrid on Heroku
ActionMailer::Base.smtp_settings = {
  :address        => 'smtp.sendgrid.net',
  :port           => '587',
  :authentication => :plain,
  :user_name      => 'app[my app number]@heroku.com',
  :password       => '[something super secret]',
  :domain         => '[let's get this party started!.com]',
  :enable_starttls_auto => true
}
ActionMailer::Base.delivery_method = :smtp

I’m sure that I’m missing something simple and basic. I’ve searched around and related questions and posts deal with how to test that ActionMailer actually sent email.

Humble gratitude in advance for any thoughts or help.

Addendum: Following answer to similar question found at Is it possible to turn off ActionMailer emails when cucumber testing is happening on development? I was able to stop the email sending madness. Still, I had to add ActionMailer::Base.delivery_method = :test to several rspec files. Is there a way I can shut this down globally? Anyone have any thoughts on what’s going on?

  • 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-05T10:04:34+00:00Added an answer on June 5, 2026 at 10:04 am

    So I’ve figured it out. Having the line ActionMailer::Base.delivery_method = :smtp in config/environment.rb overrides ActionMailer::Base.delivery_method = :test in config/environments/test.rb.

    So, delete that line, ActionMailer::Base.delivery_method = :smtp'
    from config/environment.rb and place it in config/environments/production.rb.
    That allows you to place ActionMailer::Base.delivery_method = :test in config/environments/test.rb and the version you want in config/environments/development.rb. I made development.rb :test as I populated my database using Faker and changed it to smtp so I was sure that real emails were sent as an additional check.

    Note: You must restart your server for these changes to take effect.

    Another note: Heroku’s current SendGrid Instructions put the SendGrid Heroku configuration code in a new config/initializers/mail.rb file which will likely require removing its last line and placing the desired version in each config/environments/[production.rb, development.rb, test.rb]

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

Sidebar

Related Questions

Do I need to save newly created CRM-entity instances before I can set relations
I've newly started to open my eyes for ASP.Net MVC, but on the site
can you get the last or newly added element in std::set? for example say
I'm working on a newly configured computer, and can't seem to get rails to
How can I add click event to newly added item of menu? Below is
Besides copy/paste on each newly-added View, that is... And can anyone think of any
I am newly started searching the twitter API and to gain time I would
Just looking through the newly released Gingerbread documents and I see they've added some
I newly installed PIL. But I find: I can't load any font lib using
I have a newly coded GWT/GAE app that uses RequestFactory and Editors on the

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.