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

时间:2023-01-16 10:24:13

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

问题是我在开发和生产环境中设置了邮件设置,以便从gmail域发送邮件。这很有效,但后来我决定从我的域名发送电子邮件,这是我从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

谁能告诉我为什么这个问题和解决方案一起出现在这个问题上真的是一个很大的帮助吗?

1 个解决方案

#1


2  

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

您已经在应用程序/邮件/application_mail .rb中设置了默认的from: to您的Gmail地址。

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

顺便说一句,我强烈建议您将凭证从代码基转移到环境变量中。

#1


2  

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

您已经在应用程序/邮件/application_mail .rb中设置了默认的from: to您的Gmail地址。

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

顺便说一句,我强烈建议您将凭证从代码基转移到环境变量中。