Making effective use of Pine - V ================================
As the final part of this not so exhaustive tutorial on pine, we will cover incoming folders, a feature that can really speed up the processing and archiving of email messages. We will look at them in conjunction with procmail, the most common mail filter in use today, and multiple mail servers.
Before we start though, we need to know what incoming folders are. Put simply, incoming folders are folders that your mail comes in to; automatically. In a little more technical sense, these are the files that a Mail Delivery Agent appends your incoming mails to. Don't worry if you don't know what a mail delivery agent is or does, we'll figure it out later. Your inbox is an incoming folder, and is your default incoming folder. It's probably also your only incoming folder.
For now, let's just enable the incoming folders feature in pine. In your configuration screen, move down to folder preferences, and enable incoming folders. That's it. Now, we can create folders in our incoming message folders collection, and have a delivery agent store messages in there.
Move to the Folder List screen. I hope you know how to get there by now. My guess is that your in your incoming folders collection, with the selection over INBOX, and no other folders in that collection.
We'll try and create a folder for a pop3 mailbox (imap is easier). I'm assuming here that you have a pop3 account somewhere, so if you don't, you're going to have to imagine this. If you're working on a unix box, then you could set up a local pop3 account for testing. Don't use the account that you are logged in as, because it would just use the same mailbox as your default INBOX. This could cause sharing violations.
Now, add a folder using the A key. You are asked for the server on which your folder is. If we were using an imap server, we'd just enter the name of the server here. For example, if you have a vsnl.net address, your server would be mail.vsnl.net. Since we have to tell pine that it is a pop3 server, we add this to the server name with a slash. I'm going to add my yahoo account, so I'll put in pop.mail.yahoo.com/pop3
I now have to specify the folder in which my mails are stored. If you use imap, then your server will support server folders, but in the case of pop3, you have only one folder, and this is your inbox. Specify the folder as inbox. As a nickname, you can enter anything. I prefer to call it yahoo, so that I know that it's my yahoo mail. Just make sure the nick is unique within your incoming folder collection.
Now, if you select this folder, you are prompted for a username and password. If the login is successful, you see your message index.
If you have other pop3 or imap accounts, add folders for them here. This method of reading your remote mail makes sense only if you want to leave it on the remote server always and never keep a local copy. If you want to download all your mail though, there are better methods that use programs like fetchmail and procmail.
I won't go into the set up and configuration of fetchmail and procmail. That probably deserves a tutorial series of its own. Over here, we'll just make a small procmailrc file to sort mails on sender or recipient to different folders.
First change to your mail directory and create a directory where all your incoming folders will be. This is the physical location of your incoming folders.
% cd ~/mail % mkdir incoming
Create a file called .procmailrc in your home directory, and put the following into it:
:0: *To: .*linuxers mail/incoming/lug
:0: *From: .*someone.special mail/incomin/personal
:0: *From: .*somejerk mail/incoming/boring
Then, start pine, and create incoming folders for each of the above. When prompted for the host, leave the entry blank. It defaults to a local folder. When asked for the folder name, enter the path to the folder from your home directory. This would be the same as what you put in your .procmailrc file. The first would be mail/incoming/lug, and its nick would be lug, I guess. Similarly, do the other two.
We now wait till we get mails that satisfy these rules. Let's hope at least two of our folders have received something really soon.
Assuming that you've now received some mail in your Inbox, lug folder and personal folder, start up pine, and go to your message index. Start reading your messages, press Tab when you finish reading a message. The next new message should automatically open up. When all messages in your inbox have been read, pine will prompt you to read messages in your next incoming folder. Your incoming folders are sorted alphabetically, but since you don't have any mail in boring yet (we hope), the first folder it will go to is linuxers.
Note: INBOX will always be the first folder, even if you have fodlers that start with AA.
Pine will show you the message index of the next incoming folder. Similarly, pine will run through all incoming folders that have received new mail since you last visited the folder (or started pine, whichever was later). What this means, is that if you visit a folder, but don't read any of the mails in there, the folder is still considered seen, and will not be visited through Tab cycling. You can still view it from the folder list though.
So far, we've been able to sort our mail using procmail, and view all mails on a single subject together. One more feature which helps here, is the message index sorting. Pressing $ in the message index allows you to sort the index in any of 10 sort orders. I've found, that for discussion groups, it's often helpful to sort by thread or ordered subject.
Although we can read all related mail together, we still need to manually sort them out for archiving; assuming of course that you archive some mails. I archive my lug mails, as well as those from other discussion groups, but not those that I get in my inbox. It's a pain to have to type in the entire archive folder name everytime I want to save a mail. It would have been much nicer if pine could do this for me automatically. Well, pine does.
Let's get back to the configuration screen, and add a few incoming archive folders. Move down to incoming-archive-folders, and press enter. Enter the name of your incoming folder followed by its archive folder, separated by a space. I have an entry like this for my lug mails:
incoming-archive-folders = lug lug
Notice that I can use the same name for my incoming and archive folders, because they are in different collections.
If you need to enter more than one pair, separate pairs by commas. If you already have a list, you can insert a new entry anywhere by pressing enter on the item before which you want to insert. Deletion of individual entries is also possible.
Now, everytime you leave an incoming folder, you will be prompted to save all read, but not deleted messages into the corresponding archive folder. You can avoid this prompt, by setting auto-move-read-msgs in Advanced User Preferences. You will still be prompted to expunge deleted messages in your incoming folders. This can be avoided by setting expunge-without-confirm. This flag will only affect incoming folders, and you will still be prompted for expunging deleted mails in your other folders. How to do that automatically, is left for you to find out.
This concludes the tutorial series on making effective use of pine. There's a lot more that can be done, but it's up to you to experiment with all the different configuration options. Some features can only be set through the configuration file .pinerc in your home directory.
The global configuration file is usually /etc/pine.conf. There's also a file called /etc/pine.conf.fixed. This is one of the security features of pine. If you run a site where users are not allowed to change certain options in their pine set ups, then you can put those fixed values in pine.conf.fixed. Pine reads configuration files in the order pine.conf, .pinerc, pine.conf.fixed, with each file overriding settings in the earlier ones.
Finally, read the man page.