On 2002.01.03, in <[EMAIL PROTECTED]>, "rhad" <[EMAIL PROTECTED]> wrote: > > 1) understand how exactly mutt recieves email. In my first several > attempts, I slowly gathered the impression that mutt wanted me to configure > at least sendmail and fetchmail in addition to mutt. I.e.: that mutt acts > only as a viewing agent to the standard unix mail programs. In the > successive attempts to understand sendmail and fetchmail (neither of which I > have ever used--at least knowingly) I have become slightly lost. The mutt > manual delves, IMHO, more into mutt configuration and uses, than actually > explaining how the heck to get it to recieve email.
I find it easier to think in simpler terms, just looking at definitions and relationships. Mutt reads mail folders (it doesn't receive mail from SMTP), and it hands off new mail to an MTA (it doesn't inject mail into SMTP). A "folder" can be stored on your local filesystem, or it can be stored on a networked mail server and read via a mail access protocol (POP3 or IMAP) -- not the same as mail delivery! To get new mail into your folders, you need other software. That software can be a common unix mail delivery agent like mail.local, procmail, deliver, maildrop, etc. Or it can be a program for downloading mail via an access protocol, like fetchmail. (There are other favorites, but I always forget their names.) Or it can be the delivery software on your mail server, which feeds your POP and IMAP folders themselves. So, to get new mail, you need at least one of three things: 1. A mail delivery agent (MDA) to pass messages from the mail transport agent (MTA) to a folder; 2. A program like fetchmail to pull messages down from a POP3 or IMAP server; 3. A mutt configuration that allows mutt to read messages directly from POP and IMAP message stores. Chances are that you already have at least one of these available, if you've ever used a mail program on the same system as mutt is on. > 2) Is there somebody out there who would not mind a potentially lengthy > email-fest to help me figure this out? I have (what I consider) to be a > rather weird setup: > > I want mutt to handle three email accounts: this one, at my university, and > 2 yahoo accounts. I do not live at the university, but am on DSL in the > surrounding area. Therefore, I have one dedicated outgoing mail server for > all of the accounts (swbell-DSL), and 3 pop servers for incoming mail. I > use suse linux 7.3, and I keep all my machines behind a NAT-based router > with a static IP. My workstation has an SMTP server on which I receive most of my mail. It uses sendmail plus procmail to deliver mail into a wide assortment of folders in my home directory. I also have one IMAP account and seven POP3 accounts. I check the IMAP account only occasionally, but I want the POP3 accounts to give me mail on fairly short order. Here are some ideas that come from my setup. Reading from local folders -------------------------- Normally I just run mutt with defaults: $ mutt Mutt starts up on my local inbox, which is where all the new mail I care to read lands. Procmail stores some messages elsewhere, but I don't generally worry about those until some external stimulus makes me. When that happens, I read the other folder: $ mutt -f =ignore or I change to it from inside mutt by pressing "c" and entering "=ignore". Direct IMAP ----------- I use a relatively recent 1.3 version of mutt, so the IMAP and POP support is a little different from 1.2.5's. My mutt setup reads mail from my inbox ($MAIL -- /var/mail/username) by default, since most of my incoming mail lands there. When I want to read mail from IMAP, I just run mutt with different arguments: $ mutt -f imap://imap.server.name/ or $ mutt -f '{imap.server.name}' (Actually I use it via SSL: $ mutt -f imaps://imap.server.name/ but that doesn't matter -- I mention it only because it's great that mutt supports it.) POP3 via Fetchmail ------------------ To read my POP3 messages, I have fetchmail configured to download my POP messages from all servers every 10 minutes. Fetchmail hands them off to sendmail and then procmail so that they get processed by the same procmail rules as my SMTP mail. Lines from my .fetchmailrc file look like this: poll pop.mail.yahoo.com protocol pop3 username USER password "PASS" \ smtp localhost I have a line similar to that for each server I want fetchmail to handle. And in my crontab, I have this: 0,10,20,30,40,50 * * * * /opt/bin/fetchmail >/dev/null 2>&1 This cron task makes my new POP mail come down every 10 minutes from any of the seven POP3 accounts. Direct POP3 ----------- In truth, I have more POP3 accounts, but I don't want these messages saved to my workstation's disk -- I want to browse them remotely. So, when I compiled mutt, I used the --enable-pop switch to enable POP3 browsing mode. (I also use --enable-imap, --with-krb5, and --with-ssl, by the way.) With POP3 browsing, I can run mutt like this: $ mutt -f pop:[EMAIL PROTECTED]/ That allows me to browse through and read POP3 messages as if they were local messages or IMAP messages. Handy. But this only works in later 1.3.x versions, as I recall. Automation ---------- It's not too hard to set up macros for selecting POP and IMAP folders. I've chosen the + character as a prefix to such things, for consistency. Here's an example of something you might try: macro index +in "<change-folder>!<enter>" macro index +imap "<change-folder>imap://IMAP.SERVER.NAME/<enter>" macro index +pop1 "<change-folder>pop:[EMAIL PROTECTED]/<enter>" macro index +pop2 "<change-folder>pop:[EMAIL PROTECTED]/<enter>" It might make more sense to make these editor macros, though: macro editor +imap "imap://IMAP.SERVER.NAME/" macro editor +pop1 "pop:[EMAIL PROTECTED]/" macro editor +pop2 "pop:[EMAIL PROTECTED]/" This way you can press "c" to change folders, then enter "+pop1" -- it localizes the macro a little more by making it refer just to the folder name instead of to a single action. That might be useful, for example, for saving messages to a POP or IMAP folder from within another folder: you'd just press 's' to save, then "+imap" to enter the full folder name. (You can't save messages to POP folders, though.) You can set up folder-hooks to alter settings based on which one you're using: ## When using IMAP, use folders in IMAP. Else, use local folders. folder-hook . 'set folder=~/Mail' folder-hook ^imap:// 'set folder=imap://IMAP.SERVER.NAME/' folder-hook ^imaps:// 'set folder=imaps://IMAP.SERVER.NAME/' folder-hook ^pop:// 'set folder=~/Mail/pop' $folder tells mutt where to look for your mail folders, by default -- where the "=" in "=ignore" refers to, and where the folder browser starts out. These folder-hooks make sure that while you're browsing POP folders, mutt looks for folders under ~/Mail/pop, but while using IMAP, it looks for folders on the IMAP server. The first hook makes sure that while reading all other folders, mutt finds folders in the usual location. Other stuff ----------- With all those, I finally have at least 15 e-mail addresses that I might ultimately read on my one workstation. I like having many of those addresses, though, and when I reply to a message, I want it to appear to come from the same address it was sent to, even though I'm responding from somewhere else. So I've set the reverse_name and reverse_realname variables in my .muttrc. That ensures that replies come from the address the original message was sent to, not from whatever $from is set to. Of course, my $alternates variable is large -- it's an extended regular expression about 260 bytes long. :) That was long-winded and probably both more and less than you were looking for, but maybe it will help you or someone else. -- -D. [EMAIL PROTECTED] NSIT University of Chicago