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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:05:06+00:00 2026-06-01T23:05:06+00:00

im using devise and im trying to send a welcome email after someone signs

  • 0

im using devise and im trying to send a welcome email after someone signs up using actionmailer.

i overwrote the Registration controller on devise with…

  def create
    build_resource

    if resource.save
      if resource.active_for_authentication?
        set_flash_message :notice, :signed_up if is_navigational_format?


        UserMailer.welcome_email(resource).deliver


        sign_in(resource_name, resource)
        respond_with resource, :location => after_sign_up_path_for(resource)
      else
        set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
        expire_session_data_after_sign_in!
        respond_with resource, :location => after_inactive_sign_up_path_for(resource)
      end
    else
      clean_up_passwords resource
      respond_with resource
    end
  end

in that line

UserMailer.welcome_email(resource).deliver

i call my user_mailer.rb

  default :from => "blink@gmail.com"

  def welcome_email(user)
    @user = user
    @url = "http://example.com/login"
    mail(:to => user.email, :submit => "Welcome YEAH!")     
  end

i have a view under app/views/user_mailer/welcome_email.text.erb

in my initializers folder i have a setup_mail.rb

ActionMailer::Base.smtp_settings = {
    :address                => "smtp.gmail.com",
    :port                   => 587,
    :domain                 => "gmail.com",
    :user_name              => "blink@gmail.com",
    :password               => "example",
    :authentication     => "plain",
    :enable_starttls_auto   => true
}

in my development.rb i have…

config.action_mailer.delivery_method = :sendmail
config.action_mailer.perform_deliveries = true

i am super stumped why this hasn’t been working. ive written an older project and i got the action mailer to work. the code right now is nearly identitcal to my old project. the exception is that im using devise now.

in my terminal window, when i run ‘rails server’, on that window it also says…

Sent mail to blink@gmail.com (140ms)
Date: Thu, 12 Apr 2012 12:32:48 -0700
From: blink@gmail.com
To: blink@gmail.com
Message-ID: <4f872de096f4e_1805f3fdba4834cd493153@spiderman.local.mail>
Subject: Welcome email
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_4f872de0883d4_1805f3fdba4834cd49281a";
charset=UTF-8
Content-Transfer-Encoding: 7bit
submit: Welcome YEAH!

after a user signs up. i dont think its really sending though. my gmail never gets it and its not in my spam. could it be something with devise’s mailer/views? but im explicitly using UserMailer in the controller, which is why i overwrote it

ive been stuck for days! help would be greatly appreciated. thanks a bunch

  • 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-01T23:05:07+00:00Added an answer on June 1, 2026 at 11:05 pm

    First of all, you must ensure that you tell devise were to look for your controller (since you’ve subclassed it, I assume). You can do this by editing config/routes.rb like this:

    # config/routes.rb
    devise_for :users, :controllers => {:registrations => "registrations"}
    

    If you’ve done this, ensure that your controller is the one being used. Furthermore, regarding sendmail specifically, I haven’t tried using it yet, but assuming that sendmail uses your host OS’s internal mail agent, and that you are under a dynamic IP address (which ISPs give to its users upon connection), I believe that mail providers like GMail will block your message, as they do not allow dynamic IPs to serve as mail providers. They do this for security purposes mainly. Perhaps you can check this by editing config/environments/development.rb:

    # config/environments/development.rb
    config.action_mailer.raise_delivery_errors = true
    

    to see if there is something going on under the hood. If that doesn’t help that much (and since what you are effectively trying to do is sending email using a valid mail account – given your ActionMailer settings), you can use SMTP delivery instead of sendmail, along with the configuration you have, editing this line:

    # config/environment/development.rb
    config.action_mailer.delivery_method = :smtp
    

    in your initializer which will, in fact, send the email through the account specified to the designated recipients.

    As a final (off topic) suggestion I suggest you to use Rails Observers, in which case you don’t need to overwrite Devise’s registrations controller. This would make your life much simpler, DRY and follow convention over configuration’s philosophy. You could then just create an Observer like this:

    # app/observers/user_observer.rb
    class UserObserver < ActiveRecord::Observer
      def after_create(user)
        UserMailer.welcome_email(user).deliver
      end
    end
    

    And edit config/application.rb:

    config.active_record.observers = :user_observer
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Devise gem and I want to change the redirect path after
I am using devise and create login with Facebook using omniauth, but having problem
I am trying to send mail using MFMailComposeViewController. Everything works, except that mails do
Hello I am trying to send a push message to my device using Java.
I'm trying to send push notifications to my device using javapns library in liferay
I am trying to send data over a USB to serial cable using the
I am trying to send touch events to a device using AndroidDebugBridge, so that
I'm trying to send an image using a Java server to my Android device
I am trying to create an ad hoc distribution of my App to send
Im trying to override devise in order to send mail to activate a user.

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.