Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(smtp): add config option to disable sending email via ipv6 #3009

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/senders/smtp_sender.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ def resolve_mx_records_for_domain
# @param endpoint [SMTPClient::Endpoint]
# @return [Boolean]
def connect_to_endpoint(endpoint, allow_ssl: true)
if @source_ip_address && @source_ip_address.ipv6.blank? && endpoint.ipv6?
# Don't try to use IPv6 if the IP address we're sending from doesn't support it.
if (@source_ip_address && @source_ip_address.ipv6.blank? && endpoint.ipv6?) || Postal::Config.smtp.disable_ipv6
# 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.
return false
end

Expand Down
5 changes: 5 additions & 0 deletions lib/postal/config_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,11 @@ module Postal
description "The e-mail to use as the from address outgoing emails from Postal"
default "[email protected]"
end

boolean :disable_ipv6 do
description "Disalbles sending emails via IPv6, only IPv4 will be used"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed an typo, I think Disalbles should be Disables

default false
end
end

group :rails do
Expand Down