A month on the command line, Day 6: E-mail woes

| | Comments (8) |

You'd think that e-mail and command-line Linux would be like chocolate-chip cookies and milk.

Not so. Getting e-mail from a server and into this Linux box has proven to be more than a little frustrating. Clearly I need a comprehensive reference to get this right.

I don't want to set up my own e-mail server, although at this point I'm thinking that just might be easier than the path I've been down thus far.

After extensive Googling, I decided to use Mutt as my Internet mail client, and after more extensive Googling, I figured out how to set up a rudimentary .muttrc file to get mail into this computer. So far, so good.

I wanted to use IMAP as my protocol (the account I'm using supports both IMAP and POP), and I eventually found out that Mutt will NOT send IMAP mail on its own. I don't exactly know the terminology (MTA ... MUT ...), but I decided, after more Googling, to use esmtp. I haven't gotten that to work yet. In fact, I'm not sure of the path to esmtp, which I need to put in my .muttrc file to make the whole thing work. That's how much I need to learn about Linux in general and Debian in specific.

Bottom line, I need to find a reference that really walks me through configuring multiple POP and IMAP e-mail accounts on a command-line Linux box. Any suggestions?

8 Comments

zerodni said:

the easiest way to send email is to setup exim to use a smarthost and then point that to your isp's smtp server then you can just use the mail command and just point mutt to use local host which it may all ready be doing if if you setup a mail server on the install. a good way to config this from the command line is to use dpkg-reconfigure exim4 as root

also to find a path of a command just use the whereis then the command your looking for like whereis esmtp

JBaribeault said:

Try MUTT

Thanks for the whereis command info -- I need "Linux in a Nutshell" opened up on my desk when I do this stuff.

Root said:

I think it would be worth your time to look at using Pine as your email client. I'd advise against setting up a mail server, fetchmail and other utilities just to run an IMAP client. Pine is simple to setup and use. Mutt is great, but not simple.

Eyolf said:

I just went through the thrilling ordeal of setting up mutt myself. "Ordeal" because it was - it took me a couple of days - but "thrilling" because I now know a whole lot more about mail handling than I used to.
Initially, I intended to use the IMAP options within mutt, but I ended up using the longer chain through getmail (to fetch mail from the server with a cron-job); and procmail for the filtering to the spool directory (which I set to be my regular inbox).
Apart from that, my setup includes mairix for searching in all mailboxes, urlview for extracting urls, vim for composing mail, muttprint for - uh - printing (in full LaTeX glory - wonderful!), and abook for the address book; further: antiword and pdftotext for viewing attachments inline (great!).
It was a hassle, but I now have a system which (a) I can configure precisely to my liking, and (b) I understand each single element of.
I use the maildir format, and I've set up kmail to use the same folders, so that I can view the same mails there, should I need some of the functionality of a GUI.
I'd be happy to send you my config files if you want to. It was a hassle to set it up, but once it's in place, I can't imagine using another email reader. I can really recommend mutt.

I've spent days trying to get mutt/esmtp and pine to do IMAP mail from both Fastmail.fm and DSL Extreme. I've been able to receive mail, no problem, but the whole thing falls apart when I try to SEND mail. I just can't seem to get the SMTP servers to do my bidding.

I've tried the few configuration file hints I've seen on the Web, but I've just hit a wall. Maybe POP mail will be better, but I was really hoping to do IMAP.

Even though this is "A Month on the Command Line," I booted into Xubuntu today to see how easy it was to use Thunderbird. Pretty easy -- I got both IMAP accounts to work (and with different SMTP servers for each).

Getting back to the command line, I've seen some VERY detailed config files for mutt and pine, and I wonder where in the hell people come up with this stuff.

And regarding Thunderbird, it's pretty much like Netscape Communicator's e-mail/news reader. It drove me to install the Pan newsreader (I don't read all that much USENET news, but I figured I'd try it), and that was much better -- and snappier.

But going from mutt to Thunderbird, from Elinks to Firefox, I really miss the speed of the command line, so I will live to fight another day at the console ...

Regarding pine, with copious instructions, I put together my own .deb package and installed it ... and when I couldn't get outgoing mail to work, I hastily removed and deleted the whole thing. ... That's what impatience will get you.

Again, I love the speed of the command line -- it's great for e-mail, where you can really zip right through it.

Right now I just have to regroup and rethink how I'm going about this.

Jason said:

I use Fetchmail, Mutt, Procmail and Postfix to handle my mail, and have also
changed my mind several times over the last few years over which anti-spam
tool to use.

Here's a brief summary of how it works:

  • Fetchmail retrieves incoming messages from my accounts on IMAP servers, and delivers them via SMTP (port 25) to Postfix. Fetchmail configuration involves creating a ~/.fetchmailrc file.
  • Postfix queues the messages and invokes Procmail to deliver them .
    mailbox_command = procmail -a "$EXTENSION" in /etc/postfix/main.cf
  • If there is a ~/.procmailrc file, Procmail applies the rules in it to filter the incoming messages into various folders. This implies that you don't need a ~/.procmailrc file for this setup to work, but by having one you can filter out spam and duplicate messages, filter various mailing lists into different folders, etc.
  • Mutt accesses the local mail folders (/var/mail/username as the primary inbox, and folders under ~/mail) to read the mail. Of course, mail is delivered and filtered entirely in the background.
  • For outgoing messages, you can configure Postfix with the relayhost command, as in relayhost=mail.isp.domain to deliver outbound e-mail via your ISP's SMTP server. Alternatively, you can just let Postfix deliver mail to the destination directly, without any additional configuration required. Some spam filtering services may filter out your messages if you do this. In my case, I can't tell the difference between the two alternatives, so I just let Postfix handle outgoing messages itself (without relaying via my ISP).

The point to emphasize here is that all of this isn't too difficult to set up (a certain investment in reading manual pages and setting up configuration files is needed, especially for Procmail and to a lesser extent Fetchmail), but once set up, it works really well - year after year - with only incremental improvements. That's why some of us are so addicted to this way of working. I can't remember how long it took to set up the first time, but given how well it has worked ever since, it was well worth it.

Thanks for all the suggestions, everybody. I thought that I could get by with just mutt and esmtp, but it looks like it'll take more than than.

This is not at all something I'm going to give up on -- but I would love to find a book, Web site or some other reference that covers the topic of e-mail in Linux in detail, with lots of examples and sample configuration files.

Curiously, most of the "votes" so far have been for mutt and its various helper apps, and fewer for pine.

As far as editors go, I'm already getting better with vi, though I'm growing to like nano.

And ... Midnight Commander makes things so easy, I almost feel like I'm cheating.

The one thing that is inspiring yet maddening about this is that by virtue of all the choices out there in both applications and configuration, you really can have a custom-tailored system that serves your needs.

And the other thing I'm learning from using the command line is that these apps, which work so quickly and on computers many, many years old, are still being improved and updated. It's very inspiring to someone who loves old hardware.

Leave a comment

Tech Talk column

Steven Rosenberg's weekly Tech Talk column, which appears Saturdays in the Los Angeles Daily News, is now available on the Daily News Technology page.

About this blog

Comments are back: Comments have returned to Click, but due to the thousands of spam comments clogging up the system each day, commenters must now log in. To comment, either create a Movable Type account when prompted, or create and use a Typekey account. Movable Type, as configured on this blog, allows commenters to create a Movable Type account, verify it via e-mail and then sign in to comment. Other methods of verification are OpenID, Live Journal and Vox.




Steven Rosenberg aims to learn what he does not know. He writes about it here.



About this Entry

This page contains a single entry by Steven Rosenberg published on May 8, 2007 5:18 PM.

A month on the command line, Day 6: Blog posting without a GUI was the previous entry in this blog.

MySpace and Photobucket: If you can't beat 'em, buy 'em is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Recent Comments

Steven Rosenberg on A month on the command line, Day 6: E-mail woes: Thanks for all the suggestions, everybody. I thought that I could get ...

Jason on A month on the command line, Day 6: E-mail woes: I use Fetchmail, Mutt, Procmail and Postfix to handle my mail, and hav ...

Steven Rosenberg on A month on the command line, Day 6: E-mail woes: I've spent days trying to get mutt/esmtp and pine to do IMAP mail from ...

Eyolf on A month on the command line, Day 6: E-mail woes: I just went through the thrilling ordeal of setting up mutt myself. "O ...

Root on A month on the command line, Day 6: E-mail woes: I think it would be worth your time to look at using Pine as your emai ...

Steven Rosenberg on A month on the command line, Day 6: E-mail woes: Thanks for the whereis command info -- I need "Linux in a Nutshell" op ...

JBaribeault on A month on the command line, Day 6: E-mail woes: Try MUTT ...

zerodni on A month on the command line, Day 6: E-mail woes: the easiest way to send email is to setup exim to use a smarthost and ...

Powered by Movable Type 4.21-en

Advertisement

Other blogs

About The Run Defense in Inside USC with Scott Wolf
HS FOOT: Taft up 16-0 after three quarters in Daily News High School Spotlight
Halftime: Lakers 50, Suns 44 in Inside the Lakers
Elton Brand saga Part I in Inside the Clippers
Kings vs. Capitals in Inside the Kings