Skip to content

Commit

Permalink
Connect to SMTP by IP addresses rather than hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
catphish committed Mar 22, 2023
1 parent c8d27b2 commit 159509a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/postal/smtp_sender.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def start
next
end

smtp_client = Net::SMTP.new(hostname, port)
smtp_client = Net::SMTP.new(@remote_ip, port)
smtp_client.open_timeout = Postal.config.smtp_client.open_timeout
smtp_client.read_timeout = Postal.config.smtp_client.read_timeout
smtp_client.tls_hostname = hostname

if @source_ip_address
# Set the source IP as appropriate
smtp_client.source_address = ip_type == :aaaa ? @source_ip_address.ipv6 : @source_ip_address.ipv4
end

case ssl_mode
when "Auto"
smtp_client.enable_starttls_auto(self.class.ssl_context_without_verify)
Expand Down

0 comments on commit 159509a

Please sign in to comment.