0

Rails 7.0.1 I have tried and succeeded using ActionMailer in development environment, however it doesn't work in production environment. It seems that I am not able to receive the mail that I sent.

Here is the success(able to send mail) code of ActionMailer in config/environments/development.rb

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { 
    address: '157.xxx.xxx.xxx',
    port: 25,
    authentication: :plain,
    enable_starttls_auto: false
  }
config.action_mailer.perform_deliveries = true
config.action_mailer.default_options = {from: 'hogehoge@example.com'}

Here is the failed(not able to send mail) code of ActionMailer in config/environment/production.rb after adding sidekiq and redis

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
    port: 25,
    address: '157.xxx.xxx.xxx', #same as development one
    authentication: :plain,
    enable_starttls_auto: false
  }
config.action_mailer.perform_deliveries = true
config.action_mailer.default_options = {from: 'hogehoge@example.com'}

Except raise_delivery_errors, everything remains in config/environment between development and production. Is there any place needs to be fix except config while turning into production?

dbugger
  • 15,868
  • 9
  • 31
  • 33

0 Answers0