[bug] fix extraction of uuid from message headers
[bug] fix extraction of uuid from message headers

Before this commit, the mail receiver system used to compare the domain of the
delivery addresses found in the "Delivered-To" header to find out the final
delivery address. If we assume that the mail server delivery to the spool mail
directory was correct, then we have two facts: (1) the topmost "Delivered-To"
header is the one that indicates the correct final delivery address; and (2)
we should expect the address to be <uuid>@<domain> because of the earlier
alias resolve query made by the mail server.

Another problem is that the domain comparison would compare whatever is in the
"Delivered-To" header with whatever the python's socket module would return,
which depends on the values on /etc/hosts and the order of the values in that
file. This was causing problems whenever the platform made changes in
/etc/hosts.

So this commit eliminates the domain check and gets the uuid from the first
"Delivered-To" header found in the message.

Related: #6858.

leapcode/leap_mx,leapcode/leap_mx