feat: privacy mode

Adds support for hiding IP addresses & hostnames associated with clients sending
authenticated mail in to Postal over SMTP and HTTP
This commit is contained in:
Adam Cooke
2024-02-07 09:45:09 +00:00
parent f05c2e4503
commit 15f9671b66
9 changed files with 141 additions and 59 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ class IncomingMessagePrototype
content: attachment[:data]
}
end
mail.header["Received"] = "from #{@source_type} (#{@ip} [#{@ip}]) by Postal with HTTP; #{Time.now.utc.rfc2822}"
mail.header["Received"] = Postal::ReceivedHeader.generate(@server, @source_type, @ip, :http)
mail.to_s
end
end
+1 -9
View File
@@ -175,7 +175,7 @@ class OutgoingMessagePrototype
content: attachment[:data]
}
end
mail.header["Received"] = "from #{@source_type} (#{resolved_hostname} [#{@ip}]) by Postal with HTTP; #{Time.now.utc.rfc2822}"
mail.header["Received"] = Postal::ReceivedHeader.generate(@server, @source_type, @ip, :http)
mail.message_id = "<#{@message_id}>"
mail.to_s
end
@@ -196,12 +196,4 @@ class OutgoingMessagePrototype
{ id: message.id, token: message.token }
end
def resolved_hostname
@resolved_hostname ||= begin
Resolv.new.getname(@ip)
rescue StandardError
@ip
end
end
end