TkRat mini-HOWTO

Dave Whitinger, [email protected]

v1.2, 15 September 1999


This is the TkRat mini-HOWTO. This document is geared toward anyone interested in using their Linux computer to send and receive Internet E-Mail.

1. Introduction

2. Installing TkRat

3. Downloading your E-Mail

4. Configuring TkRat

5. Using TkRat

6. Automatically sorting mail into folders

7. Copyright

8. Acknowledgements


1. Introduction

This document is maintained by Dave Whitinger ( [email protected]). Please mail me with any questions or ideas you have regarding this HOWTO.

This document will attempt to describe the following four things:

  1. Installing the TkRat E-Mail program.
  2. Downloading mail from an Internet Service Provider.
  3. Reading, storing, and sending mail
  4. Sorting the mail into folders

The document assumes that you are running Linux with the X Window System, have already established a connection to an Internet Service Provider, and have a POP account with that provider.

Disclaimer: All usual disclaimers apply. The author cannot be held responsible for any (mis)use of the information given here. This document does not attempt to be authoritative in any way. The author voluntarily creates this document seperately from any entity with which he may be involved with. By reading this document, you agree to cause the author no grief or trouble. :)


2. Installing TkRat

I would like to stress that there are many excellent E-Mail programs available for Linux. It is always a matter of personal preference when selecting which one you will use. That said, I will tell you that I have been using a program called "TkRat" for over 2 years now - and I love it. It's a graphical program that has all the features you would expect from a quality mail program, it's easy to learn how to use, it's powerful, and it's free. For these reasons, I'll only be covering TkRat in this HOWTO.

The first thing you need to do is download TkRat. You can either obtain the sources and compile them, or you can get the binaries.

Here are some URLs for the software:

When you have downloaded the tarfile, you are ready to install it on your system.

To install the tar.gz source, use the commands:


tar -zcvpf tkrat-2.0b3.tar.gz
cd tkrat-2.0b3
./configure
make
make install

If anything fails, consult the INSTALL and README files located in the tkrat-2.0b3 directory. Note that you will need a version of tcl that is greater than 8.1 for this to compile. You can obtain the latest tcl from scriptics.com.

Congratulations - TkRat should now be installed on your system.


3. Downloading your E-Mail

In order to read E-Mail, it is usually best to download it using a program called "fetchmail". The following instructions are known to work perfectly for version 2.2 of fetchmail - although they should be applicable to any version.

(Note: Fetchmail is almost certainly already installed on your system, as it is included in all Linux distributions that I know of - if anyone knows this to be untrue, please let me know!).

Perform the following steps:


echo "server pop.com protocol pop3 username dave password foo" > ~/.fetchmailrc

(Make sure to replace "pop.com" with the hostname to your ISP's pop server.  Replace
"dave" with your username, and replace "foo" with your username's password.)

Now, whenever you want to check your E-Mail, just type "fetchmail" at the prompt. Fetchmail will go off and download all your mail and store it in your local mail folder.


4. Configuring TkRat

>From the prompt, type "tkrat" and press enter. Click on "Create". Read the message it gives you, then click on "Continue". At this point, you are brought to the main TkRat program. The first thing you should do is customize it to your local system.

  1. Go the Admin menu, and select Preferences.
  2. Click on "Sending"
  3. Enter in your E-Mail address in the "Default Reply-To" field.
  4. Enter in your E-Mail address, followed by paranthesis in the "Use from address" field. e.g. [email protected] (Dave Whitinger)
  5. Enter your domain name in the "Domain" field. If your E-Mail address is "[email protected]" you'll enter "xyz.com".
  6. Click on "Apply".
  7. Click on "Method".
  8. For "Send Via" select "SMPT".
  9. In the SMTP host: field, enter the SMPT server address of your ISP (they should be able to provide you with this information).
  10. Click "Apply", then "Dismiss".


5. Using TkRat

Upon starting TkRat, You'll notice that you are in a folder called "INBOX". Use fetchmail to download any new mail. If you have any, it will appear in this INBOX folder.

TkRat has an intuitive interface. The top half of the screen is the list of messages you have (Each line is a seperate E-Mail). The bottom half of the screen will be the actual content of the E-Mail.

You can read E-Mails by simply clicking on any message in the list.

When you are finished reading a message, you can move on the next message, reply to that message, compose a new message, or move the message to a different "Folder".

Folders are a way of storing E-Mails into seperate "Folders". This way, you can keep several folders for different topics you may receive E-Mail about.

Perform the following steps to create folders:

  1. Click on Admin, then New/Edit Folders
  2. You will see a box with a "INBOX" folder. Left-Click in that box.
  3. You are then presented with a menu, so select "New File Folder".
  4. You'll be given a dialogue box asking for information.
  5. In the first textbox - enter a name for the folder.
  6. In the second textbox - enter the filename you will use to store the messages in (Hint: Use something like /home/username/mail/name_of_folder. So, if the first field says "Personal", the second field would say something like "/home/dave/mail/personal" (assuming your username is dave).
  7. Click OK. You'll notice your new folder is now in the list of folders. So, go to "Window" and then "Close".

You can now Move messages to the new folder - and switch to that folder by selecting the folder's name under the "Folders" menu.

Sending mail is also easy. Click "Compose", type in the recipient's E-Mail address, type in a subject, and then write the message in the body.

When you are finished, click on Send.


6. Automatically sorting mail into folders

If you're like me, you get about 3,500 messages a day. Each time you fetch your mail, you have to wade through all the messages looking for particular ones that interest you.

This is not a problem anymore, thanks to Procmail.

Procmail works like this: Procmail examines each message as it is downloaded, and will perform a series of tasks based upon certain rules that you've specified.

Let's say, for example, that I get about 200 messages every day from a certain mailing list (in this example, I'm using the linux-foo list). Rather than have all those messages go directly into my main inbox, I would rather that they were automatically filtered into a box called "foo-list".

The first step is to take an example mail message that came from that mailing list and examine the mail headers.

I begin to notice a pattern. Every message that comes from that mailing list has a line that says:

Sender: [email protected]

I can now tell procmail to place every message that contains this line into a certain folder.

The way I tell this to procmail is by way of a ".procmailrc" file.

I will use my favorite text editor to create a text file in my home directory called ".procmailrc".

The file will look something like this:


LOGFILE=$HOME/.pmlog
MAILDIR=$HOME/mail
VERBOSE

# linux-foo list
:0 Hw
* ^.*[Ss]ender: [email protected]
foo-list

# if it got to this point, put it in my new mail folder
:0 Hw
newmail

Examine the "[Ss]ender" line. You'll notice that that line is the one thing that all messages from that mailing list have in common.

That section is telling procmail that when it sees a message come through with a header that looks like the above, to put it into the "foo-list" folder.

The next section is saying that if the message matched nothing above, to just place it into newmail.

Now, let's say that anytime I get a message from my good friend, EJ, I want it to go into a folder called "EJ".

I'll just create a new section of my procmailrc file. See below:


LOGFILE=$HOME/.pmlog
MAILDIR=$HOME/mail
VERBOSE
 
# linux-foo list
:0 Hw
* ^.*[Ss]ender: [email protected]
foo-list

# Message from E.J.!
:0 Hw
* ^.*[Ff]rom: [email protected]
ej
 
# if it got to this point, put it in my new mail folder
:0 Hw
newmail

Notice the new section for EJ. When a message comes in with his E-Mail address in the "From" field, it will automatically place it into my "ej" folder.

Now, let's say that there's some lamer out there who keeps on E-Mailing me. I don't want to hear from him, but he's persistent. Once again - procmail to the rescue.

So, let's say I don't ever want to see any mail from Bill Gates. I can setup a recipe to delete any mail that comes from him. Look at my new procmailrc:



LOGFILE=$HOME/.pmlog
MAILDIR=$HOME/mail
VERBOSE
 
# Is it coming from Bill Gates?  If yes, DELETE IT!!!
:0 Hw
* ^.*[Ff]rom: [email protected]
/dev/null

# linux-foo list
:0 Hw
* ^.*[Ss]ender: [email protected]
foo-list
 
# Message from EJ!
:0 Hw
* ^.*[Ff]rom: [email protected]
ej
 
# if it got to this point, put it in my new mail folder
:0 Hw
newmail

Now I have a rather nice procmailrc file. Let's examine what procmail will do to each message as it comes in.

At first, it checks the message to see if it is from "[email protected]". If it is, delete it, and it's done.

If the message made it through the first check, it will see if it has the "[email protected]" in the headers. If it does, it will put it into the "foo-list" folder, and it's done.

If the message still makes it past that, then it checks to see if it's from EJ. If it is, it places it into the "ej" folder.

Now, if the message passes all those tests, then it should just place it into my newmail folder.

Once you have these folders in place and procmail is properly filtering the mail, you can just go into TkRat, "Admin - New/Edit Folder" and create the folders for each filename. They will be located under /home/username/mail/foldername.


7. Copyright

This HOWTO is copyright 1998, 1999 by Dave Whitinger, and is a free document. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.


8. Acknowledgements

Very special thanks go out to Martin Forsse'n ([email protected]) for authoring the TkRat mail user agent.

Greetings go out to the North Texas Linux User's Group in Dallas, TX, for whom I originally wrote this document back in early 1998. Today no greetings go out to any user groups, as I live in the moutains of East Tennessee, where I believe I am the only Linux user (or computer user, for that matter) within 50 miles.

Also of note: Nic Bernstein has forked the TkRat code to create a mailer called Postilion. It looks like a great mailer with a lot of new features that aren't in TkRat, but, nevertheless, I continue to use TkRat.