Tools of the Trade

As there are many uses for electronic mail, there are many ways to cut code that creates or receives mail, including the perennial favorite C. More modern (that is, abstracted) means exist, including Perl and Java. The primary advantages of Perl and Java are their cross-platform natures and their powerful networking abilities.

Perl, made popular by its use as a World Wide Web scripting language, is a perfect language for dealing with electronic mail. It has powerful text parsing capabilities that are essential when dealing with the Internet’s text-based mail system. Perl is also readily extensible by writing modules, many of which are freely available from the Comprehensive Perl Archive Network (CPAN). The CPAN includes several Perl modules relating to electronic mail, and they are covered in Chapter 13, Email-Related Perl Modules.

For an introduction to Perl, see Learning Perl, published by O’Reilly Media. For a more complete Perl reference, a copy of Programming Perl (also published by O’Reilly) is highly recommended.

Most of the examples in this book are presented in Perl, although it should be straightforward to port them to other languages.

Perl is well suited to the scripting of mail-related actions, such as test scripts or the movement of mail from one system to another. At least one person is known to be working on a Perl/Tk graphical mail user agent. Example Perl scripts are shown in Chapter 15, Creating and Sending a Multipart Mail Message, and Chapter 16, Archiving and Cleaning a Mailbox.

Java is also well known for its Web-based antics in the form of embeddable applets. However, Java is a maturing and well-regarded tool for creating servers as well. At the time of this writing, Java has been successfully used to create several commercial electronic mail clients and servers. Java has a good set of network-oriented APIs, including the relatively recent Java Mail API described in Chapter 14, The Java Mail API.

Java is an excellent choice for those wishing to create mail transfer agents, network-based mail delivery agents, gateways to other mail systems, and graphical mail user agents. If one wishes to create a graphical mail user agent with the ability to run in a Web environment, Java is one of very few choices.

For a good general reference on Java, see Java in a Nutshell, published by O’Reilly Media.

Get Programming Internet Email now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.