#!/bin/sh

SMTP_DIR="/home/nwserv.sys/mail/smtp"

for file in $SMTP_DIR/*
do
  if [ -e $file ]; then
    FROM=`grep "^From:" $file | head -1 | sed -e 's/.*<//' -e 's/>.*//'` TO=`fromdos < $file | sed -n '2,/^$/p'` echo -n "$FROM -> $TO ..." fromdos < $file | sed '1,/^$/d' | sendmail $TO
    echo " done." rm $file
  fi
done
