Always use -w and use strict.
my $textfile = "iwn.txt";
Use my to declare variables under use strict.
open TEXT, $textfile or die "Can't Open $textfile";
my ($email, $id);
$email ||= $_ if /Email address:/;
$id ||= $_ if /Message-Id:/;
You were using C style looping. Perl loops are much nicer.
$x ||= $y (or equals) is the same as $x = $x || $y. The end effect for you is $id gets a value only if it doesn't already have one.
Pulling these variables out of the loop ensures they only get printed once.