Improved message_id generation (more random).

This commit is contained in:
Martin Edenhofer 2019-04-05 18:18:34 +02:00
parent b6093930e3
commit 13854f7fa7

View file

@ -38,7 +38,7 @@ class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer
# generate message id, force it in prodution, in test allow to set it for testing reasons # generate message id, force it in prodution, in test allow to set it for testing reasons
if !record.message_id || Rails.env.production? if !record.message_id || Rails.env.production?
fqdn = Setting.get('fqdn') fqdn = Setting.get('fqdn')
record.message_id = "<#{DateTime.current.to_s(:number)}.#{record.ticket_id}.#{rand(999_999)}@#{fqdn}>" record.message_id = "<#{DateTime.current.to_s(:number)}.#{record.ticket_id}.#{rand(999_999_999_999)}@#{fqdn}>"
end end
# generate message_id_md5 # generate message_id_md5