Answer the question
In order to leave comments, you need to log in
How to approach the Errno::ECONNREFUSED (Connection refused - connect(2) for "example.com" port 25) error?
Every time I try to send an email on the production server I get this error instead of the sent email:
Errno::ECONNREFUSED (Connection refused - connect(2) for "example.com" port 25)
Rails.application.configure do
...
config.action_mailer.default_url_options = { host: "localhost" }
config.action_mailer.default_options = { from: '[email protected]' }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
address: "example.com",
}
end
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
# TLS parameters
smtp_tls_security_level = may
smtp_tls_note_starttls_offer = yes
smtpd_tls_security_level = may
smtpd_tls_cert_file=/etc/letsencrypt/live/example.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/example.com/privkey.pem
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = dsde949-12345.fornex.org
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, example.com, dsde949-12345.fornex.org, localhost.fornex.org, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all
$ sudo systemctl status postfix.service
● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/lib/systemd/system/postfix.service; enabled; vendor preset: enabled)
Active: active (exited) since Thu 2021-03-18 18:45:36 CET; 29min ago
Process: 1110 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 1110 (code=exited, status=0/SUCCESS)
[email protected]:~/rails/current$ telnet example.com 25
Trying 123.123.155.190...
telnet: Unable to connect to remote host: Connection refused
[email protected]:~/rails/current$ telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 xxx.fornex.org ESMTP Postfix (Ubuntu)
...
config.action_mailer.smtp_settings = {
address: "localhost",
}
OpenSSL::SSL::SSLError (hostname "localhost" does not match the server certificate):
Answer the question
In order to leave comments, you need to log in
I don't understand what's going on here? What was banned in google translator? Can't connect to port 25 on example.com for some reason, like no one is listening there (or banned in the firewall)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question