ec - Mail reader and composer for Unix and Perl/Tk.


ec [-f filename] [-hkvdo]

Command Line Options

-f filename

Use filename instead of the default server authentication file.


Print help message and exit.


Don't delete messages from POP server.


Print verbose transcript of dialogs with servers.


Print debugging information on the terminal.


Off line - don't fetch mail from server.


Sorting Messages
Entering Messages
File Attachments
Configuration Files
Mail Directories and Folders
Mail Transport Agents
Editing the Library Path Names in the Source File
X Font Resources
Folder Indexes


Ec can send and receive mail to and from remote POP3 and SMTP servers, or route mail using sendmail, qmail, or exim. Ec can filter and store incoming messages in user configurable folders. With no additional configuration, ec routes mail to the Incoming folder. (Ec capitalizes the first letter of directory names when creating folder names.) The Folder menu displays the number of unread and total messages. Ec can move messages from folder to folder, including the Trash folder, and also encode and decode Base64 MIME attachments.

Ec permanently deletes messages stored in the Trash folder after a user configurable period of time (two days is the default). Mail can be undeleted by removing messages from the Trash folder. Refer to the section, "Configuration Files," below.


Ec displays two windows: a list to select messages for reading, viewing, sorting, saving, and deleting, and a text window to compose messages.

To view a message for reading, replying, or saving to a file, click the left mouse button, button 1, on the message header in the list window.

Moving and deleting also operates on multiple messages by clicking on each message with the left mouse button, button 1, while pressing the Control key.

Starting Ec

To start ec, type at the shell prompt in an xterm:

   # ec

The program displays the main window with the Incoming mail folder. If the program displays an error message that it cannot connect to the POP mail server, use the -v command line option to produce a transcript of the dialog with the server:

  # ec -v

You can select different mail folders from the Folder menu, and move messages from one folder to another by selecting the destination folder from the Message - Move To submenu.

The File - Browse URL function pops up a dialog box with the URL under the text cursor. Clicking, "OK," opens the browser configured in the .eccconfig file, and loads the Web page. If the browser is already open or iconified, ec uses that browser window to view the URL. Ec supports netscape versions 4.5-4.7, amaya version 2.4, opera version 5.0, and lynx in an xterm. Lynx may also need its xterm options defined in the .ecconfig file.

The Attachments - Attach File... option in the compose window opens a window to select files. Attachments - Remove Attachment displays a submenu of the message's file attachments. Refer to the section, "File Attachments," below.

There are a number of options for quoting messages when composing a reply. Refer to the .ecconfig file for information about these options.

Ec also uses the X clipboard to cut and paste between windows in ec as well as windows in other applications. For programs that do not have Cut, Copy, or Paste menu options, select text in the source application's window by holding down the left mouse button and dragging it across the text to highlight it, then changing to the destination window and pressing the middle mouse button (or the left and right buttons simultaneously on mice with only two buttons).

Sorting Messages

You can select whether to sort messages by Date (the default), the sender, or the subject, either newest first or oldest first, by selecting the sort field from the Options - Sort by submenu and the Options - Sort Order submenu, and by clicking on the headings of the message listing.

Entering Messages

The New button below the message list and Message - Compose New Message menu item opens a composer window with a new message form with header lines for the addressee, the subject, and the name of the FCC (File Carbon Copy) file to save a copy of the message in. If you have a ~/.signature file (refer to the .ecconfig file), ec inserts the signature at the end of the message text.

Clicking the Reply button, or selecting Message - Reply from the menu opens a compose window with the address and subject of the original message filled in, and the message quoted in the text area. There are several options which determine how ec fills in reply addresses and quotes original messages.

Each message contains header information and body text, separated by a boundary line:

  --- Enter the message text below this line. ---

This line must exist for ec to process the message, but it is not included in the outgoing message.

Outgoing messages require at least a valid mail address to be entered on the "To:" header line.

The Edit - Insert Field submenu provides optional Cc: Bcc:, Fcc: and Reply-to: headers fields.

Ec supports a limited form of address, "unfolding." A To:, Cc:, Reply-To:, or Bcc: line can contain more than one mail address. Multiple addresses must be separated by commas.

File Attachments

Ec supports a subset of the Internet MIME specification which allows files to be sent as attachments to messages.

To save a file that is attached to an incoming message, select the file from the File - Attachments menu. Type the name of the file to save the attachment to in the dialog box.

To attach files to outgoing messages, select the Attachments - Attach File... menu item in the compose window. Then select the file from the dialog box's list or by entering its name. The file(s) are listed on the Attachments - Remove Attachment submenu. Selecting an attachment removes it.

When a message contains file attachments, ec also encloses the text of the message as a MIME text/plain section, and sets the message header's Content-Type: field to multipart/mixed.


The file README contains installation instructions.

Configuration Files

The program uses two configuration files, .ecconfig and .servers. The default configuration directory is ~/.ec, which is configurable by editing the paths in ec and The configuration files and directory are not visible in normal directory listings. Use the -a option to ls to view them:

  # ls -a ~/.ec

The .ecconfig file contains user-settable defaults for the program's operating parameters using <option> <value> statements on each line. The function of each setting is explained in the .ecconfig file's comments.

You can also edit the .ecconfig file by selecting Help - Sample .ecconfig File.... Pressing the right mouse button (button 3) pops up a menu over the text area. where you can save your changes. You must exit and restart ec for the changes to take effect.

The .servers file contains the user login name, host name, port, and password for each POP3 and SMTP server. Ec allows incoming mail retrieval from multiple POP3 servers, but only allows one SMTP server to send outgoing mail. The format of each line is:

  <server-name> <port> <user-login-name> <password>

In standard configurations, POP3 servers use port 110, and the single SMTP server uses port 25. 110 info  password-for-info 110 sales password-for-sales 25  info  password-for-info

If there is a hyphen, -, in the password field, ec prompts for the server's password.

If you need to use different addresses for outgoing messages, you can edit the From: or Reply-to: line of message header so that the mail originates from the address you want and replies get sent to the appropriate address.

The .servers file must have only user read-write permissions (0600), otherwise the program prints a warning message. The permissions can be set with the command:

  # chmod 0600 .ec/.servers

You must be the owner of the file to set its permissions.

The .servers file is not editable from the Help menu.

Mail Directories and Folders

EC saves messages in user-configurable "folders," or directories, and can move messages between folders via the Message - Move To submenu. The mail folders are subdirectories of the maildir setting, which is ~/Mail by default.

Assuming that a user's $HOME directory is /home/bill, the directories that correspond to mail folders are:

  Option     Value      Path
  ------     -----      ----
  maildir    ~/Mail     /home/bill/Mail
  incoming   incoming   /home/bill/Mail/incoming
  trash      trash      /home/bill/Mail/trash

The Incoming and Trash directories must exist before using EC. The program will not create them on its own.

Ec makes the first letter of folder names uppercase, regardless of whether the directory name starts with a capital or small letter.

All other directories can be configured in the .ecconfig file, using the folder directive. You must create the directories before ec can move messages into them. If a directory doesn't exist, ec prints a warning saves the message in the Incoming folder.

The mail program mutt also uses a directory named Mail to store messages. You should change the name of ec's, maildir option in .ecconfig so that ec's message storage does not conflict with mutt's mail storage.


You can sort incoming mail by matching the text in an incoming message with a specified pattern. Each filter line in the .ecconfig file is composed of a text pattern, a double equals sign, and the folder the mail is to be saved in. The format of a filter line in the configuration file is:

  filter <text-pattern>==<folder-directory>

Text patterns can contain any of the metacharacters Perl recognizes (refer to the perlre man page). Pattern matches are not case sensitive. The folder-directory that the pattern matches must exist.

Perl recognizes as metacharacters some characters that are also common in mail addresses. They must by preceded by a backslash. These characters include: @, [, ], <, and >. Refer to the example filter definitions in the .ecconfig file.

Mail Transport Agents

In addition to an ISP's SMTP server, ec can send outgoing messages via sendmail, qmail, or exim. In the .ecconfig file, the usesendmail, useqmail, and useexim options determine which MTA, if any, is used. If the value of of any of these options is non-zero, then outgoing mail is routed to the MTA.

If no MTA is selected, ec sends and receives messages directly to and from a remote mail host. In this case it will not process messages from a local mail transport agent.

In most sendmail configurations, either the local sendmail must be configured to relay messages, or have a smart host defined. The comments in the .ecconfig file describe only a few of the possible settings. Refer to the sendmail documentation for further information.

The exim configuration (selected by setting useexim to non-zero) is similar to sendmail, exim allows mail routing to a remote smart host without setting a From: domain address in ec, if the system administrator created an entry for the domain mail address in /etc/email-addresses.

If the useqmail option is set, make sure that you can execute the qmail-inject program, which is /var/qmail/bin/qmail-inject in qmail's default configuration. Ec still connects directly to an ISP's POP3 server, and uses the system UNIX mailbox, usually /var/spool/mail/<user>, for incoming messages.

The qmail-inject -f option is not implemented. The format of the sender's return address can be set using environment variables. Refer to the qmail-inject manual page for information.

Editing the Library Path Names in the Source File

If you would like to change the path names of library files, use a text editor to edit the values of $iconpath, $cfgfilename, $serverfilename, and $base64enc at the beginning of the library modules they appear in.

The expand_path function expands leading tildes ('~') in file and path names to the value of the $HOME environment variable, following the convention of the UNIX Bourne shell. Directory separators are forward slashes ('/'), so compatibility with non-UNIX file systems depends on the Perl environment to perform the path name translation.

X Fonts

Consult the file, README for information about setting X Window System font resources, and the comments in .ecconfig for setting fonts with the program's configuration options.


Folder Indexes

Although ec attempts to maintain an accurate index of read and unread messages in each folder, it is possible, if you upgrade to a later version, or backup and then delete messages manually, that the folder indexes will not match the actual contents of the folder.

In this case, you must delete the file named .index in each of the folders. For example, to delete the indexes in the Incoming and Trash folders, use these commands:

  # rm Mail/incoming/.index
  # rm Mail/trash/.index

If ec does not find the .index file it will, as when you first ran the program, display a message that it is creating a new .index file. The messages themselves are not affected, but you need to select them again to prevent the program from showing their status as u for, "unread."


It is possible produce this documentation in various formats using Perl's POD formatting utilities:

  pod2html <ec >doc.html
  pod2latex <ec >doc.tex
  pod2man <ec >
  pod2text <ec >doc.txt
  pod2usage <ec >doc.hlp

Refer to your system's manual pages for instructions of how to use these utilities.


Copyright © 2001-2004 Robert Kiesling,

Ec is licensed under the same terms as Perl. Please refer to the file, "Artistic."

$Id: ec,v 1.7 2004/03/02 22:29:54 kiesling Exp $


perl(1), Tk(1)


  Windows-specific routines written by Roland Bauer.

  The POP server interface is based on:
  POPMail Version 1.6 (RFC1081) Interface for Perl,
      Written by:
      Kevin Everets <>
      Abhijit Kalamkar <>
      Nathan Mahon <>
      Steve McCarthy <>
      Sven Neuhaus <>
      Bill Reynolds <>
      Hongjiang Wang <>

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 2848:

You forgot a '=back' before '=head1'

Around line 3182:

Non-ASCII character seen before =encoding in '©'. Assuming ISO8859-1