class Mail::Message

def ==(other)

m1 == m2 #=> false
m2 = Mail.new("Message-ID: \r\nSubject: Hello\r\n\r\nHello")
m1 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")

m1 == m2 #=> true
m2 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")
m1 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")

m1 == m2 #=> true
m2 = Mail.new("Subject: Hello\r\n\r\nHello")
m1 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")

m1 == m2 #=> true
m2 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")
m1 = Mail.new("Subject: Hello\r\n\r\nHello")

m1 == m2 #=> true
m2 = Mail.new("Subject: Hello\r\n\r\nHello")
m1 = Mail.new("Subject: Hello\r\n\r\nHello")

So, in practice the == operator works like this:

different Message-ID value, then they are false.
the same content, ignoring the Message-ID field, unless BOTH emails have a defined and
So the == operator has been defined like so: Two messages are the same if they have

that the two objects are unique, and this comparison will ALWAYS return false.
as the assigned Message-IDs by Mail (if not already defined as the same) will ensure
mail1.encoded == mail2.encoded is most probably not going to return what you think
gotcha here is that Mail will insert Message-IDs when calling encoded, so doing
Two emails are the same if they have the same fields and body contents. One
def ==(other)
  return false unless other.respond_to?(:encoded)
  if self.message_id && other.message_id
    self.encoded == other.encoded
  else
    dup.tap { |m| m.message_id = '<temp@test>' }.encoded ==
      other.dup.tap { |m| m.message_id = '<temp@test>' }.encoded
  end
end