#!/bin/sh

MAILBOX=./mail
export MAILBOX
mails=`echo *.mail`
for mail in ${mails}; do
	if test -r $mail; then
		cat $mail | sed '1,2s/.*<//' | sed '1,2s/>.*//' | sed -E '1,2s/[^a-zA-Z0-9]|@.*//g' | python deliver.py
		rm $mail
	fi
done
echo "Mails delivered"
