1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-11-30 21:32:30 +00:00

refactor: move lib/postal/received_header to app/lib/received_header

هذا الالتزام موجود في:
Adam Cooke
2024-02-22 22:38:17 +00:00
ملتزم من قبل Adam Cooke
الأصل 5cc9eb3df7
التزام e3bc9da253
6 ملفات معدلة مع 35 إضافات و37 حذوفات

عرض الملف

@@ -1,32 +0,0 @@
# frozen_string_literal: true
module Postal
class ReceivedHeader
OUR_HOSTNAMES = {
smtp: Postal.config.dns.smtp_server_hostname,
http: Postal.config.web.host
}.freeze
class << self
def generate(server, helo, ip_address, method)
our_hostname = OUR_HOSTNAMES[method]
if our_hostname.nil?
raise Error, "`method` is invalid (must be one of #{OUR_HOSTNAMES.join(', ')})"
end
header = "by #{our_hostname} with #{method.to_s.upcase}; #{Time.now.utc.rfc2822}"
if server.nil? || server.privacy_mode == false
hostname = DNSResolver.local.ip_to_hostname(ip_address)
header = "from #{helo} (#{hostname} [#{ip_address}]) #{header}"
end
header
end
end
end
end