#################################################
sub deliver_by_disk_write {
local $line;
local $thismail;
# We're seeking to deliver this piece of email by
# writing it directly to a -user's- mail directory
# on disk -- and so we need to make sure we know
# this is really "our" user, and that s/he has a mail
# directory. We'll lowercase whatever's now stored
# in $header{'To:'} after all our work on it, and
# strip away all but the username part of the address.
$to_whom = lc $header{"To:"};
if ($to_whom =~ /<?(.*\@.*)[>|\s]/) { $to_whom = $1; }
foreach $person (@local_receivers)
{
if (($x = $header{"To:"}) && ($x =~ /$person\@.*/))
{
# We'll use &get_next_file_number again, this time
# passing it this user's mail directory location.
$newcount = &get_next_file_number("$mail_root/$person");
# $mail_root and $file_ext_if_one_each are from
# the top of the program (or from a setup file)
$thismail = "$mail_root/$person/$newcount.$file_ext_if_one_each";
# Finally we write the email directly to disk
# and notify the user at the console as we do.
open (USERMSG,">$thismail") or die "eek! -- can't write to disk";
if (defined USERMSG)
{
print "\n writing: /$person/$newcount.$file_ext_if_one_each";
while ($line = <TMPMSG>)
{
print USERMSG "$line";
}
close (USERMSG);
}
last;
} # end of if (($x = $header...
} # end of foreach $person
} # end of sub deliver_by_disk_write