in reply to Sending emails in perl/cgi environment

Modules are your most cherished friends.

For this sort of task, and for many thousands of others, you will always find that “somebody else has done it,” and that “they have done it very, very well.”

Which means, in short, that you don't have to do it all over again! With very, very little effort on your part, you are rewarded with a block of code that is well-tested and known to work. You do not waste time “reinventing the wheel.”