简体   繁体   English

Ruby on rails动作邮件程序从之前的设置发送邮件

[英]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 . 问题是我在开发和生产环境中设置了邮件设置,以便从gmail域发送邮件。 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 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 我不知道如何,但我仍然收到来自gmail域名的邮件和我作为发件人提供的旧gmail ID

Can anyone please tell me why this is happening along with the solution wud be really a great help stuck in this issue 任何人都可以告诉我为什么会发生这种情况以及解决方案真的是一个很好的帮助卡在这个问题

You have set the default from: to your Gmail address in your app/mailers/application_mailer.rb . 您已将default from:设置default from: app/mailers/application_mailer.rb Gmail地址。

BTW I would highly recommend you to move credentials out of the codebase into the environment variables. 顺便说一下,我强烈建议您将凭证从代码库移到环境变量中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM