Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on rails action mailer sending mails from previous setting

Hi i have an app in which i am using action mailer to send the mail ,

i am drowned in this really weird issue

the issue is i set up the mail setting in the development and the production environment to send the mails from the gmail domain . that worked perfectly but then i decided to send emails from my domain which i purchased from the go daddy

this is my code

development.rb

  # Raise an error on page load if there are pending migrations.
  config.active_record.migration_error = :page_load
  config.consider_all_requests_local       = false
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  ActionMailer::Base.perform_deliveries = true
  # SMTP settings for gmail
  config.action_mailer.smtp_settings = {
      :address              => "smtpout.secureserver.net",
      :port                 => 80,
      :domain               => "jobzgo.com",
      :user_name            => 'mydomainemailid',
      :password             => 'mydomainpasswrd',
      :authentication       => "plain",
      :enable_starttls_auto => true
  }

in controller

 def create
  @form = Form.create(form_params)
    if @form.save
      FormMailer.registration_mail(@form).deliver
      redirect_to forms_path
    end
  end

i dont know how but i am still receiving the mails from gmail domain and the old gmail id i provided as the sender

Can anyone please tell me why this is happening along with the solution wud be really a great help stuck in this issue

like image 675
user4965201 Avatar asked Nov 19 '25 00:11

user4965201


1 Answers

You have set the default from: to your Gmail address in your app/mailers/application_mailer.rb.

BTW I would highly recommend you to move credentials out of the codebase into the environment variables.

like image 65
Tobias Avatar answered Nov 21 '25 19:11

Tobias