+# !defined($rcpt) if we have no recipients
+# make the list unique to prevent dupes being normally filtered by sendmail(8)
+# one '{' is block-wrapper, another '{' is hash-indirection!
+# hash keys are just strings, never refs!
+# unify the list as Mail::Address instances
+my @rcpts=(!@addr ? (undef()) : values(%{{ map({
+ my $obj=$_;
+ $obj=parseone $obj if !ref $obj;
+ (!defined $obj ? () : (lc($obj->address())=>$obj));
+ } @addr) }}));
+
+# We may (=will) change the contents and send it multiple times
+# prevent wasteful Message-ID regeneration if it is just for one rcpt
+if (@rcpts>1 && defined(my $msgid=$head->get("Message-ID"))) {
+ $head->delete("Message-ID");
+ $head->replace("X-LaceMail-sendmail-Message-ID",$msgid);
+ }
+