Trying to set up Mailgun for RoR4.2 app development environment but still getting the above error. As I understood from this answer there is problem with config development file.
This is my config/environments/development.rb:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
host = 'my_app.c9.io'
config.action_mailer.default_url_options = { host: host }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.mailgun.org',
port: '2525',
domain: ENV["MAILGUN_DOMAIN"],
user_name: ENV["MAILGUN_USERNAME"],
password: ENV["MAILGUN_PASSWORD"],
authentication: :plain,
enable_starttls_auto: true,
}
As suggested here I also checked environment variables in console, they are properly set. I'm using port 2525 as suggested here and here. Any ideas what can be wrong?
So I finally get the answer, for whatever reason Cloud9 don't accept environment variables here so I had to hardcode them and had to use "hashrocket" format:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
host = 'my_app.c9.io'
config.action_mailer.default_url_options = { host: host }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.mailgun.org',
:port => '2525',
:authentication => :plain,
:user_name => 'postmaster@xxxxxxxxxxxxxxxxx.mailgun.org',
:password => 'xxxxxxxxxxxxxxxxxxx',
:domain => 'sandboxxxxxxxxxxxxxxxxxx.mailgun.org',
:enable_starttls_auto => true
}
If anybody knows how to use environment variables in Cloud9 config development file please comment here.