feat: remove strip_received_headers config option

This previously removed all Received headers which were sent to the smtp
server when enabled. This is not something that should be happening.
This commit is contained in:
Adam Cooke
2024-02-07 09:45:12 +00:00
parent 15f9671b66
commit ed2e62b94f
2 changed files with 0 additions and 6 deletions
-1
View File
@@ -72,7 +72,6 @@ smtp_server:
ssl_version: <%= ENV.fetch('SMTP_SERVER_SSL_VERSION', 'SSLv23') %> ssl_version: <%= ENV.fetch('SMTP_SERVER_SSL_VERSION', 'SSLv23') %>
proxy_protocol: <%= ENV.fetch('SMTP_SERVER_PROXY_PROTOCOL', 'false') %> proxy_protocol: <%= ENV.fetch('SMTP_SERVER_PROXY_PROTOCOL', 'false') %>
log_connect: <%= ENV.fetch('SMTP_SERVER_LOG_CONNECT', 'false') %> log_connect: <%= ENV.fetch('SMTP_SERVER_LOG_CONNECT', 'false') %>
strip_received_headers: <%= ENV.fetch('SMTP_SERVER_STRIP_RECEIVED_HEADERS', 'false') %>
max_message_size: <%= ENV.fetch('SMTP_SERVER_MAX_MESSAGE_SIZE', '14') %> # size in Megabytes max_message_size: <%= ENV.fetch('SMTP_SERVER_MAX_MESSAGE_SIZE', '14') %> # size in Megabytes
smtp_relays: smtp_relays:
-5
View File
@@ -393,15 +393,10 @@ module Postal
if @header_key && @headers[@header_key.downcase] && @headers[@header_key.downcase].last if @header_key && @headers[@header_key.downcase] && @headers[@header_key.downcase].last
@headers[@header_key.downcase].last << data.to_s @headers[@header_key.downcase].last << data.to_s
end end
# If received headers are configured to be stripped and we're currently receiving one
# skip the append methods at the bottom of this loop.
next if Postal.config.smtp_server.strip_received_headers? && @header_key && @header_key.downcase == "received"
else else
@header_key, value = data.split(/:\s*/, 2) @header_key, value = data.split(/:\s*/, 2)
@headers[@header_key.downcase] ||= [] @headers[@header_key.downcase] ||= []
@headers[@header_key.downcase] << value @headers[@header_key.downcase] << value
# As above
next if Postal.config.smtp_server.strip_received_headers? && @header_key && @header_key.downcase == "received"
end end
end end
@data << data @data << data