Ruby on rails action mailer 从之前的设置发送邮件
Ruby on rails action mailer sending mails from previous setting
嗨,我有一个应用程序,我在其中使用动作邮件发送邮件,
我被这个非常奇怪的问题淹没了
问题是我在开发和生产环境中设置了邮件设置以从 gmail 域发送邮件。效果很好,但后来我决定从我的域发送电子邮件
我从 go daddy 那里购买的
这是我的代码
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
}
在控制器中
def create
@form = Form.create(form_params)
if @form.save
FormMailer.registration_mail(@form).deliver
redirect_to forms_path
end
end
我不知道如何,但我仍然收到来自 gmail 域的邮件和我作为发件人提供的旧 gmail id
谁能告诉我为什么会出现这种情况以及解决方案
wud 真的是解决这个问题的好帮手
您已将 default from:
设置为 app/mailers/application_mailer.rb
中的 Gmail 地址。
顺便说一句,我强烈建议您将凭据从代码库移到环境变量中。
嗨,我有一个应用程序,我在其中使用动作邮件发送邮件,
我被这个非常奇怪的问题淹没了
问题是我在开发和生产环境中设置了邮件设置以从 gmail 域发送邮件。效果很好,但后来我决定从我的域发送电子邮件 我从 go daddy 那里购买的
这是我的代码
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
}
在控制器中
def create
@form = Form.create(form_params)
if @form.save
FormMailer.registration_mail(@form).deliver
redirect_to forms_path
end
end
我不知道如何,但我仍然收到来自 gmail 域的邮件和我作为发件人提供的旧 gmail id
谁能告诉我为什么会出现这种情况以及解决方案 wud 真的是解决这个问题的好帮手
您已将 default from:
设置为 app/mailers/application_mailer.rb
中的 Gmail 地址。
顺便说一句,我强烈建议您将凭据从代码库移到环境变量中。