As noted, there are plenty of mail servers available, you want to use someone else's or install one, not rewrite the wheel. But if you are setting up your own, you might find that using Perl to filter your mail is a good way to learn more Perl. For details read up on
. (I have not used it, but it looks handy.)