mirror of
https://github.com/postalserver/postal.git
synced 2026-10-18 10:17:22 +00:00
fix: raise an error if MX lookup times out during sending
This avoids potentially sending mail to the A record when an MX query times out. closes #2833
This commit is contained in:
@@ -162,7 +162,7 @@ class SMTPSender < BaseSender
|
||||
#
|
||||
# @return [Array<String>]
|
||||
def resolve_mx_records_for_domain
|
||||
hostnames = DNSResolver.local.mx(@domain).map(&:last)
|
||||
hostnames = DNSResolver.local.mx(@domain, raise_timeout_errors: true).map(&:last)
|
||||
return [SMTPClient::Server.new(@domain)] if hostnames.empty?
|
||||
|
||||
hostnames.map { |hostname| SMTPClient::Server.new(hostname) }
|
||||
|
||||
Reference in New Issue
Block a user