From: Adeodato Simó Date: Thu, 9 Jul 2009 19:55:17 +0000 (+0200) Subject: Use /etc/mailname if present to determine the hostname for Message-Id X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=9988356aa6fd50d09ffdaf64c9d4ad27f7d48612;p=sup Use /etc/mailname if present to determine the hostname for Message-Id Signed-off-by: Adeodato Simó --- diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb index f956d65..a48930a 100644 --- a/lib/sup/modes/edit-message-mode.rb +++ b/lib/sup/modes/edit-message-mode.rb @@ -73,7 +73,14 @@ EOS @attachment_names = [] end - @message_id = "<#{Time.now.to_i}-sup-#{rand 10000}@#{Socket.gethostname}>" + begin + hostname = File.open("/etc/mailname", "r").gets.chomp + rescue + nil + end + hostname = Socket.gethostname if hostname.nil? or hostname.empty? + + @message_id = "<#{Time.now.to_i}-sup-#{rand 10000}@#{hostname}>" @edited = false @selectors = [] @selector_label_width = 0