Skip to content
Snippets Groups Projects
Commit 2a9702ba authored by mackinra's avatar mackinra Committed by Charlie Smurthwaite
Browse files

Added option to strip incoming Received headers (#282)

parent 457afb90
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -70,6 +70,7 @@ smtp_server:
tls_private_key_path: # Defaults to config/smtp.key
proxy_protocol: false
log_connect: true
strip_received_headers: false
 
smtp_relays:
-
Loading
Loading
Loading
Loading
@@ -327,7 +327,9 @@ module Postal
@receiving_headers = true
 
received_header_content = "from #{@helo_name} (#{@hostname} [#{@ip_address}]) by #{Postal.config.dns.smtp_server_hostname} with SMTP; #{Time.now.rfc2822.to_s}".force_encoding('BINARY')
@data << "Received: #{received_header_content}\r\n"
if !Postal.config.smtp_server.strip_received_headers?
@data << "Received: #{received_header_content}\r\n"
end
@headers['received'] = [received_header_content]
 
handler = Proc.new do |data|
Loading
Loading
@@ -357,6 +359,9 @@ module Postal
@header_key, value = data.split(/\:\s*/, 2)
@headers[@header_key.downcase] ||= []
@headers[@header_key.downcase] << value
if Postal.config.smtp_server.strip_received_headers? && @header_key.downcase == "received"
next
end
end
end
@data << data
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment