简体   繁体   中英

Error: Connection refused - connect(2) for “localhost” port 25

Trying to send mail with Mailgun as default.

Successfully connects to heroku telnet smtp.mailgun.org with ports 25 587 (TLS) and 465 (SSL)

The config for smtp is setup like the documentation wants. The environment variables were generated by Mailgun/Heroku and I updated the domain per the documentation to the mx record change.

Rails.application.config.action_mailer.delivery_method = :mailgun
Rails.application.config.action_mailer.mailgun_settings = {
  api_key: ENV['MAILGUN_API_KEY'],
  domain: ENV['MAILGUN_DOMAIN'],
}

I know I've seen this error on a few threads, but I've yet to make this work.

I'll reply if I find another thread that solves this before this one figures it out.

This has been figured out. Here was my issue:

The configuration settings should go in environments/production.rb and environments/development.rb

NOT in a mailgun.rb initializer.

Thanks for playing. Woo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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