A month on the command line, Day 27: E-mail Valhalla, if not Nirvana

| | Comments (7) |

After a few weeks of wrangling with e-mail at the console, I now have a working setup that allows me to send and receive mail from two accounts, one personal, the other for work, on my Debian Etch box.

(For those who haven't been following that closely, my hardware is a Maxspeed Maxterm thin client with hard drive and CD-R drive connected to the single IDE header. The motherboard is by ECS, it's sort-of mini-ITX sized, the processor is a VIA C3 Samuel at 1 GHz with VIA's PC133 chipset, and memory is maxed out at 256 MB.)

I'm using mutt as the mail client and msmtp as the SMTP client for outgoing mail. And while real geeks use vi, I've become partial to nano of late, and that's been my default editor for e-mail ... and everything else.

My personal account is with freelinuxemail.com, which looks like, acts like and is provided by fastmail.fm, but which includes free use of their SMTP server. Linspire sponsors the service, and I think they're picking up the tab. (Thanks, Linspire!) The service is IMAP only, which I prefer anyway, because I need to access my mail from a variety of places, programs and PCs.

However, my work account is on a POP server, and I really don't want to pull all the mail off the server and onto a single PC -- and I could never get the company's outgoing SMTP server to work. Instead, I'm using the SMTP server from my broadband provider, DSL Extreme (who's tech support department declined to help me with this project, since, as they told me, "You know we don't support Linux." I figured it out anyway, and I will keep trying to figure out my company's SMTP server, even though everything is working just fine like it is.

The main sites that helped me get all of this working were the main mutt site (mutt.org), the msmtp site, an article from O'Reilly's MacDevCenter.com titled How to Use mutt, FastMail, and Mail.app Together on Your Mac, even though I'm not using a Mac, and My First Mutt, and all are required reading before you embark on this yourself. That and about a hundred Google searches for sample configuration files and advice specific to these programs and my mail providers.

And before I continue, yes, I tried Pine, but I could never really get it to work, especially for the outgoing mail.

The key here is that mutt is configured to read e-mail from my IMAP account. To read my POP mail, I hit lower-case "c" to navigate to other folders, and instead of an IMAP or local folder, I go to my POP site and then log in. The e-mail comes up from my POP account, and I can read, delete and reply to messages, but what I don't delete remains on the POP server, accessible by my Web-based client, Outlook on my Windows box and Thunderbird (or SeaMonkey) on my Linux boxes. (I got the lower-case "c" trick from My First Mutt. Works like buttah.

Here's how I do it:

(type lower case letter) c
pop://pop.mypopaddress.com (note: use pops:// if it's a secure server)
(at prompt for login, enter my e-mail address)
(at prompt for password, enter my password, then the mail appears)

As I said, I haven't yet gotten msmtp to work with my company's SMTP server yet, but I did get it to work with DSL Extreme's (substituting my work e-mail address in the "From" category).

I can choose to send mail from three different accounts, freelinuxemail.com, my work account and dslextreme.com with key bindings I created with help from msmtp's manual (the section on using msmtp with mutt).

Things I'm going to work on in the near future are shortcuts for frequently-used e-mail addresses and some kind of system for organizing saved mail in my /home directory.

Here are my config files:

.muttrc

set use_from=yes
set editor=nano
set imap_user=myaddress@freelinuxemail.com
set imap_pass=mypassword
set spoolfile=imaps://mail.messagingengine.com/INBOX
set folder=imaps://mail.messagingengine.com/INBOX
set record=+"Sent Items"
set postponed=+"Drafts"
set certificate_file=~mutt_certificates
set envelope_from=yes
set sendmail="/usr/bin/msmtp"
set realname="Steven Rosenberg"
macro generic "<esc>1" ":set
from=myaddress@freelinuxemail.com"
macro generic "<esc>2" ":set
from=myaddress@dailynews.com"

.msmtprc (make sure this is set to read/write ONLY by you. The command is: $ chmod go= .msmtprc )

account linux
host mail.messagingengine.com
from myaddress@freelinuxemail.com
auth on
tls on
user myaddress@freelinuxemail.com
password mypassword

account dsl
host smtp.dslextreme.com
from myaddress@dailynews.com
#for "user" in DSL Extreme, the @ and everything after it are not needed
user mydslextremelogin
password mypassword
#auth login is the only authentication that worked (I went through every one that msmtp offers before I tried this one)
auth login

It's probably not a great idea to have passwords in the config files, but it does speed things up, and once I pull the CD-ROM drive, it'll be pretty secure, especially because it doesn't boot from USB either. That's assuming anybody around here a) wants to read my terribly exciting e-mail and b) knows what Linux even is, let alone how to hack into it.

One of the things I'm going to try in the future is to remove the passwords and maybe even the user names and see how the setup works then. For now, it really speeds things up to have user names and passwords entered automatically.

Another must: getting the e-mails to display with the newest on top (they're now on the bottom).

It's taken a couple of weeks to get to this point, and I'd like to thank all the readers of this blog who wrote comments and told me about their console-based e-mail setups.

While on this project, I also set up all of my mail accounts in Thunderbird, but where's the fun in that?

Again, the greatest thing about e-mail at the Linux console is the blinding speed with which e-mail can be read, replied to and deleted.

I've been keeping mutt running on tty1, with a text-based Web browser -- either lynx or elinks -- on tty2. Both browser have their good points -- elinks has better CSS support, but sometimes looking at a page with no CSS in lynx is better. I'm sure I can turn off CSS in elinks, but it's just as easy to start the other app.
I should probably start using a third virtual console with Midnight Commander running, but I haven't been using mc that much lately. Still, if you're using the Linux command line and not using at least two or three virtual consoles, switching between them with alt-F1/F2/F3/etc., you're not really living.

As far as the e-mail setup goes, there are probably better ways to do it, and like all highly configurable applications at the console, it has the potential to grow, change and morph depending on my needs and skills.

While I cited many of the Web pages that helped me, I'd also like to acknowledge the books that have taught me much about the Linux command line. My main book, my bible if you will, is "The Linux Cookbook, Second Edition" by Michael Stutz (here's the free online version of the first edition, but it's well worth buying and having at hand). Stutz's book is so well-written and complete that it's an enjoyable read as well as a valuable reference. Even though it was published in 2004, it remains extremely useful, since the command line isn't subject to the faddishness of the GUI ... not that a new edition wouldn't be welcome.

I've also been using "Linux in a Nutshell," by Ellen Siever, Stephen Figgins and Aaron Webber, another great O'Reilly book, and I've just gotten the other Linux cookbook, titled "Linux Cookbook," by Carla Schroder, also from O'Reilly ... also published in 2004 (and still plenty useful, although again, a new edition would be great.

Since this is Day 27 of A Month on the Command Line, here are the things I haven't gotten done yet:

-- Printing: I tried the trusty Apsfilter, which has worked for me on occasion in Damn Small Linux, but I couldn't get it to find a network printer. I will try CUPS before this is all done, and I think that will work. But why didn't Debian ask me about printers during the install?

-- vi/Vim: I never got that good at running vi or Vim. I read somewhere that even when you're running vi in Debian, it's really Vim. I'll have to look into that. But while I type fast and have to write stuff really fast, I didn't crave the ease with which I could move around the page in vi. I grew attached very quickly to nano, which, with it's F3 keystroke to save and F9 to delete a line, quickly became my favorite command-line app.

-- Images without X: I didn't do much with Imagemagick. Since I couldn't actually view an image in that suite without X, I never got to the point of sizing a photo at the command line. Zgv was already installed in Debian, but it died while trying to display a photo. I checked the config file, and it should've worked but didn't.

-- Blogging from the command line: I never did try out the program that allows direct posting to Movable Type blogs. It's something I'd still like to try, but once I had e-mail working, the will to continue wasn't quite as strong. I did post from elinks to the blog, but it wasn't easy (and for some reason the posts didn't go live without "intervention" from a GUI browser).

But I did a lot of Web browsing with lynx and elinks -- and both are extremely fast and enjoyable ways to read text on Web pages. I highly recommend trying them at the command line.

What separates Linux from Windows and Mac is the fact that Linux from the command line is made up of apps that are up to date (they have to be, given that they're running production servers at very high levels in the enterprise) and extremely configurable. The fact that you can run the Linux command line on hardware that's extremely old and underpowered, yet get all the modern security features that Linux has to offer, is a powerful incentive to use it, especially for older hardware. I've blogged extensively on how to keep older Macs running, on which browsers work, which e-mail programs support today's servers (answers are few and Netscape Mail) and how a decade-old, unsupported OS can function in the modern computing world. But with Linux, all that fades away. Window managers go from full-featured and heavy to extremely light ... and there's always the shell. Linux developers care about users -- and not about rendering old hardware obsolete so you'll buy whatever's new just so you'll have apps that run.

And while the books I've mentioned above have been very, very helpful, I'd love to see a command-line book that walked the newbie through all the apps and setup of a Linux system, with specific instructions on how to set up e-mail, network connections, with even more information on all the current command-line apps. Kind of like what the "Cookbooks" do, but with more specific information on going from nothing to a full command line system. I guess there's not quite the market that there is for Ubuntu/SUSE/Fedora books, or for books aimed at sysadmins, but it would be nice to see. The fact that you can easily set up even Ubuntu as a command-line-only system -- and not just as a server -- makes this something that I think more people would do, if they only knew how.

7 Comments

Jason said:

Have you tried the threaded sort order in Mutt? This will speed up e-mail
reading even more than the standard sort ordering, and there are additional
commands to navigate by thread/subthread.

Nano and Pico are really toys as far as editors are concerned; if you're going to use an editor extensively for serious writing and editing, Vi and Emacs (or, nowadays, Vim and Emacs) are still far ahead of the rest.

For printing, yes, Cups works, and you can even use the Web-based interface with Lynx/Elinks. Shortly after making the move from MS-DOS to Linux in the late 90's I bought a Postscript printer, which was very easy to set up and just worked.

I agree that someone should write the book which you propose, as there are a lot of people who only know the GUI, and whose level of understanding is consequently very limited, but who would gladly embrace a more powerful environment.

Pizzasgood said:

It is possible to view images on the commandline. It requires that you use a framebuffer device though. That means using the vgz= boot option, where is the number of the desired mode (I use 795 for 1280x1024x24).

Depending on your kernel, you might also have to modprobe fbcon in order to see any text.

Once you're up and running with the framebuffer, apps can use it to display images. I'm not very familiar with which apps are out there though. The only one I've used is FBV, which is a simple program for displaying most images. It has options for slide-shows, fitting the screen, and I think flipping the image. I'm actually using a significant part of the source code from FBV in a project to add a boot-splash to Puppy (I call it Pebble, because it's a little splash).

I've also heard of a GUI environment using the framebuffer, and I'm sure there are games and stuff too.

But even without all that stuff, it's nice just because you can get more screen space than in a conventional setup.

Pizzasgood said:

Meh, it mistook some of my last post for html and I had a typo. The correct boot option is vga=XXX, where XXX is the mode number (found by googling VESA framebuffer modes).

To repeat, use vga, NOT vgz!

dbr said:

Have you tried "screen"?
Instead of having to use different tty's for each application, you simply do :
"screen bash"
And you get.. bash.. But, if you do ctrl+a, then hit c, you get another instance of bash.
Type ctrl+a,p and it goes to the previous terminal, ctrl+a,n to the next one.
Typing ctrl+a,d detaches the screen-session, but leaves everything running in the background.
This doesn't seem hugely useful until you log in remotely (via SSH), and type screen -r (or screen -xU as I normally do - -x reattaches without disconnecting other instances of screen like -r does, and -U enables UTF-8) - You are back to your screen session, with all your running applications as they were

The Gentoo Wiki is one of the better pages on screen I've found (There was a good screen-tutorial, but I can't remember where it was, could have been digg.com)
http://gentoo-wiki.com/TIP_Using_screen

maelcum said:

Have you tried bash blogger for blogging?
http://bashblogger.grimthing.com/

R Wood said:

If you are tempted by mutt you might be interested in my Woodnotes Guide to the Mutt email client. It's a manual I've developed over many years of using and teaching Mutt and is available under the Creative Commons License: http://therandymon.com/content/view/42/79/

It's two months since this post, and I've learned since then that my company's mail server offers IMAP, not just POP. So I'm back to using mail clients -- I'm just about to set up mutt for it. One thing I'd like to figure out (and I'm reasonably sure the info is out there) is how to manage multiple IMAP accounts in mutt.

For POP accounts, mutt is surprisingly flexible. You can get your mail directly in mutt, or use a program like fetchmail to grab mail for all your various accounts and then manage them with procmail (or just have them in a big hopper and use mutt to read and reply).

As far as text editors go, emacs is something I'm just not going to even try. And while I have some history with vi from the '80s, where it was the only editor available on the UC Santa Cruz Unix system, I'm spending so much time in "normal" editors for my job that I feel most comfortable with nano, and that is the text editor I've been using the most.

I understand that it's theoretically easier to navigate through a document in vi with its command mode and home-row directional keys, but I'm just so used to using the arrow keys and the backspace and delete keys that nano "just works" for me.

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 29, 2007 5:00 PM.

Is now the time to dump your laptop hard drive for flash media? was the previous entry in this blog.

Maroon 5 breaks iTunes record 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 27: E-mail Valhalla, if not Nirvana: It's two months since this post, and I've learned since then that my c ...

R Wood on A month on the command line, Day 27: E-mail Valhalla, if not Nirvana: If you are tempted by mutt you might be interested in my Woodnotes Gui ...

maelcum on A month on the command line, Day 27: E-mail Valhalla, if not Nirvana: Have you tried bash blogger for blogging? http://bashblogger.grimthing ...

dbr on A month on the command line, Day 27: E-mail Valhalla, if not Nirvana: Have you tried "screen"? Instead of having to use different tty's for ...

Pizzasgood on A month on the command line, Day 27: E-mail Valhalla, if not Nirvana: Meh, it mistook some of my last post for html and I had a typo. The c ...

Pizzasgood on A month on the command line, Day 27: E-mail Valhalla, if not Nirvana: It is possible to view images on the commandline. It requires that yo ...

Jason on A month on the command line, Day 27: E-mail Valhalla, if not Nirvana: Have you tried the threaded sort order in Mutt? This will speed up e-m ...

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