Skip to content

Commit 13436f9

Browse files
authored
Merge pull request #23 from modalsource/QuinnDamerell-postal-disable-ipv6-sending
Replica: feat(smtp): add config option to disable sending email via ipv6
2 parents 956cfc5 + 1e28f97 commit 13436f9

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

app/senders/smtp_sender.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ def resolve_mx_records_for_domain
177177
# @param endpoint [SMTPClient::Endpoint]
178178
# @return [Boolean]
179179
def connect_to_endpoint(endpoint, allow_ssl: true)
180-
if @source_ip_address && @source_ip_address.ipv6.blank? && endpoint.ipv6?
181-
# Don't try to use IPv6 if the IP address we're sending from doesn't support it.
180+
if (@source_ip_address && @source_ip_address.ipv6.blank? && endpoint.ipv6?) || Postal::Config.smtp.disable_ipv6
181+
# Don't try to use IPv6 if the IP address we're sending from doesn't support it or if it's disabled in the config.
182182
return false
183183
end
184184

lib/postal/config_schema.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,11 @@ module Postal
418418
description "The e-mail to use as the from address outgoing emails from Postal"
419419
default "postal@example.com"
420420
end
421+
422+
boolean :disable_ipv6 do
423+
description "Disalbles sending emails via IPv6, only IPv4 will be used"
424+
default false
425+
end
421426
end
422427

423428
group :rails do

0 commit comments

Comments
 (0)