Welcome!

Linux Containers Authors: Zakia Bouachraoui, Liz McMillan, Elizabeth White, Pat Romanski, Stefana Muller

Related Topics: Linux Containers

Linux Containers: Article

More on properly training Mutt

How to set scores for incoming messages, and work with SMTP servers.

(LinuxWorld) -- I was surprised by the number of readers who expressed interest in Mutt after reading last week's column. I had no idea that so many people are still willing to use a character-based mail client in this age of GUI everything.

To those who asked if it is worth switching from Pine to Mutt, the answer is an emphatic "yes"! If after a few months you find that you still prefer Pine, I'd love to know why.

One reader pointed out that I neglected to mention the message-scoring feature in Mutt. I neglected it because, frankly, I don't use it. It's a great feature, and I even configured Mutt to score messages, but I simply haven't developed the habit of using message scores.

On the chance that you'll find it more compelling than I do, here's how it works. You can assign scores to messages based on whether the message header matches certain criteria. Then you would usually sort your messages based on the scores, so that the most important messages rise to the top of the inbox, and the unimportant ones drop to the bottom.

You can assign flat-rate scores, or you can define your rules so some messages will accumulate higher scores if they match multiple criteria. A common technique for scoring messages is to start with a base score (I start with 500) and then add or subtract from this number based on a number of rules.

The sample

The best way to illustrate scoring is probably by example. Here is a sample list of scoring rules.

The first line with the tilde-A tells Mutt to add 500 to every message. This starts the scoring process by giving all messages a base score of 500. Then it checks the messages against the remaining conditions and adds or subtracts from the score according to the matches it may find. Don't tell anyone, but I subtract 100 for every message I get from my LinuxWorld editor Mark Cappel so I can safely ignore anything he sends my way. (Ed.: Which is only fair, since I ignore what Nick sends me.)

The one exception to the process of adding and subtracting from scores is when you precede a score number with an equal sign. The equal sign gives the message the score you've specified and then stops the scoring process. For example, if the subject line contains "sex" or "adult," it gives the message a score of 0 and stops looking for any more matches. Messages with the word "Urgent" in the subject line will rise to the top with a score of 1000. This is a handy way to dump spam messages to the bottom of the pile, or raise important messages to the top by giving them a huge score. The latter is useful, but I personally prefer to filter spam at the server as mail is received, not at the client through scoring or any other technique.

score '~A'                      +500
score '~s sex|~s adult'           =0  # spam
score '~f anonymous'              =0  # If you cannot afford a name then don't send mail to me!

score ~F +100 # flagged mails are important score '~s Urgent' =1000 # Urgent in subject line score '~f Mark_Cappel' -100 # Editor score '~f Tommy_Peterson' +200 # Editor score '~f Maryfran_Johnson' +200 # Editor score '~f Tish_Keefe' +200 # Editor score ~D =0 # "this is a deleted email..."

Once you have your scoring definitions, you can sort your inbox based on the scores. To do this by default, include this line in one of your Mutt configuration files:

set sort=score

Since I don't usually use scoring as a method of finding e-mails, I defined macros to let me switch between an inbox sorted by score and an inbox reverse-sorted by date. The key sequence comma-i gets me to the inbox reverse-sorted by date, and the key sequence comma-o gives me an inbox sorted by score. Here are those macros:

   macro index ",i"  "c=INBOX\nOd="    # reverse-sort by date
   macro index ",o"  "c=INBOX\noc="    # sort by score

Ignore this header

Another nifty feature of Mutt is the ability to ignore certain portions of the mail header. Here are the contents of my muttrc.ignore file. I could say the comments in this file are mine, but they're not. They were already in the file I used as a model for my configuration. I don't recall where I got that file, but I find the comments amusing.

## Ignore everything but the really important lines:
   ignore *
# The most important lines:
  unignore from date subject to cc reply-to:
#
#          Sender:
   unignore sender:
#
# Priorities should be heeded - even if M$ Outlook calls it "importance.."
   unignore priority: importance:
#
# "Org-Lines" - can be fun to read:
   unignore organization organisation
#
# see the identification of the "user agent":
   unignore user-agent: x-agent: x-mailer: x-newsreader: x-mailing-list:
#
# recognize CCs from Usenet:
   unignore message-id: newsgroups: posted-to: x-also-posted-to:
#
# Darned Lotus identifies with "X-Lotus-FromDomain" :-(
   unignore x-lotus

# X-Resent-To: [email protected] unignore x-resent # # WebTV is invading us!!! Aiiiee! unignore x-webtv

Sending mail

Mutt has one annoying weakness. It doesn't include SMTP capability, so you have to use an external mailer in order to send mail. There are pros and cons to this approach. On the up side, Mutt doesn't need to re-invent the SMTP wheel, since there are plenty of free, open source SMTP mailers around. I use both exim and postfix. On the down side, you have to configure your SMTP mailer properly or you won't be able to use Mutt to send any mail.

Unfortunately, there are too many SMTP programs for me to cover them all, and even if there were only one, there is no "right" way to configure your SMTP program for use with Mutt. You'll need to configure your SMTP program according to your needs.

In my case, I use CommuniGate Pro to send all outgoing mail. I configured exim to forward all outgoing mail to my CommuniGate Pro server, which then sends the mail to its destination. There are several places in the exim.conf file that I customized, but here is the most important bit:

# Remote addresses are those with a domain that does not match any item
# in the "local_domains" setting above.

# Send all mail to a smarthost

smarthost: driver = domainlist transport = remote_smtp route_list = "* petreley.com bydns_a" end

Note that the above will only work if there is a real domain called petreley.com. You can't get away with making up a domain name and placing that name here.

More Stories By Nicholas Petreley

Nicholas Petreley is a computer consultant and author in Asheville, NC.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


IoT & Smart Cities Stories
While the focus and objectives of IoT initiatives are many and diverse, they all share a few common attributes, and one of those is the network. Commonly, that network includes the Internet, over which there isn't any real control for performance and availability. Or is there? The current state of the art for Big Data analytics, as applied to network telemetry, offers new opportunities for improving and assuring operational integrity. In his session at @ThingsExpo, Jim Frey, Vice President of S...
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settl...
@CloudEXPO and @ExpoDX, two of the most influential technology events in the world, have hosted hundreds of sponsors and exhibitors since our launch 10 years ago. @CloudEXPO and @ExpoDX New York and Silicon Valley provide a full year of face-to-face marketing opportunities for your company. Each sponsorship and exhibit package comes with pre and post-show marketing programs. By sponsoring and exhibiting in New York and Silicon Valley, you reach a full complement of decision makers and buyers in ...
Two weeks ago (November 3-5), I attended the Cloud Expo Silicon Valley as a speaker, where I presented on the security and privacy due diligence requirements for cloud solutions. Cloud security is a topical issue for every CIO, CISO, and technology buyer. Decision-makers are always looking for insights on how to mitigate the security risks of implementing and using cloud solutions. Based on the presentation topics covered at the conference, as well as the general discussions heard between sessio...
The Internet of Things is clearly many things: data collection and analytics, wearables, Smart Grids and Smart Cities, the Industrial Internet, and more. Cool platforms like Arduino, Raspberry Pi, Intel's Galileo and Edison, and a diverse world of sensors are making the IoT a great toy box for developers in all these areas. In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists discussed what things are the most important, which will have the most profound e...
The Jevons Paradox suggests that when technological advances increase efficiency of a resource, it results in an overall increase in consumption. Writing on the increased use of coal as a result of technological improvements, 19th-century economist William Stanley Jevons found that these improvements led to the development of new ways to utilize coal. In his session at 19th Cloud Expo, Mark Thiele, Chief Strategy Officer for Apcera, compared the Jevons Paradox to modern-day enterprise IT, examin...
Rodrigo Coutinho is part of OutSystems' founders' team and currently the Head of Product Design. He provides a cross-functional role where he supports Product Management in defining the positioning and direction of the Agile Platform, while at the same time promoting model-based development and new techniques to deliver applications in the cloud.
There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
LogRocket helps product teams develop better experiences for users by recording videos of user sessions with logs and network data. It identifies UX problems and reveals the root cause of every bug. LogRocket presents impactful errors on a website, and how to reproduce it. With LogRocket, users can replay problems.
Data Theorem is a leading provider of modern application security. Its core mission is to analyze and secure any modern application anytime, anywhere. The Data Theorem Analyzer Engine continuously scans APIs and mobile applications in search of security flaws and data privacy gaps. Data Theorem products help organizations build safer applications that maximize data security and brand protection. The company has detected more than 300 million application eavesdropping incidents and currently secu...