The configuration of your mailer should / can be defined in both development and production . The purpose of this configuration is that when you configure this parameter when you use actionmailer , these SMTP parameters will be used. You may have a simple mail program, for example:
Mailer
class UserMailer < ActionMailer::Base default :from => DEFAULT_FROM def registration_confirmation(user) @user = user @url = "http:
controller
def create @title = 'Create a user' @user = User.new(params[:user]) if @user.save UserMailer.registration_confirmation(@user).deliver redirect_to usermanagement_path flash[:success] = 'Created successfully.' else @title = 'Create a user' render 'new' end end
So what happens here is that when you use the create action, the UserMailer . Looking at the aforementioned UserMailer, it uses ActionMailer as a base. Below is the SMTP setting, which can be defined both in config/environments/production.rb and development.rb
You will have the following:
config.action_mailer.default_url_options = { :host => 'portal.herokuapp.com' } config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => 'smtp.gmail.com', :port => 587, :domain => 'gmail.com', :user_name => ' EMAIL_ADDRESS@gmail.com ', :password => 'pass', :authentication => 'login', :enable_starttls_auto => true }
If you want to define SMTP settings in design mode, you will replace
config.action_mailer.default_url_options = { :host => 'portal.herokuapp.com' }
with
config.action_mailer.default_url_options = { :host => 'IP ADDRESS HERE:3000' }
This should be a detailed enough explanation to start with you in the right direction.
David source share