Without Devise
Since, you are following the RailsCasts episode for Sending Email
then in that case all you need to do is update UsersController#create
as below:
def create
@user = User.new(params[:user])
if @user.save
UserMailer.signup_confirmation(@user).deliver ## Add this
redirect_to @user, notice: "Signed up successfully."
else
render :new
end
end
With Devise
Option #1 Sending a welcome confirmation mail
What you can do here is, override the after_sign_in_path_for
method in ApplicationController as below:
class ApplicationController < ActionController::Base
## ...
protected
def after_sign_in_path_for(resource)
UserMailer.signup_confirmation(@user).deliver ## Add this
your_path(resource) ## Replace your_path with the path name where you want to send the user after sign in
end
end
Option #2 Sending a welcome confirmation mail with confirmation token
For this you will need to use Devise built-in Confirmable
module.
Confirmable: sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
Refer to Confirmable Documentation