moved reading of mail file out of process_mail() function.