Welcome!

Linux Containers Authors: Elizabeth White, Zakia Bouachraoui, Liz McMillan, Yeshim Deniz, Pat Romanski

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
In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential. Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...
Bill Schmarzo, Tech Chair of "Big Data | Analytics" of upcoming CloudEXPO | DXWorldEXPO New York (November 12-13, 2018, New York City) today announced the outline and schedule of the track. "The track has been designed in experience/degree order," said Schmarzo. "So, that folks who attend the entire track can leave the conference with some of the skills necessary to get their work done when they get back to their offices. It actually ties back to some work that I'm doing at the University of San...
When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science," is responsible for setting the strategy and defining the Big Data service offerings and capabilities for EMC Global Services Big Data Practice. As the CTO for the Big Data Practice, he is responsible for working with organizations to help them identify where and how to start their big data journeys. He's written several white papers, is an avid blogge...
Dynatrace is an application performance management software company with products for the information technology departments and digital business owners of medium and large businesses. Building the Future of Monitoring with Artificial Intelligence. Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more busine...
If a machine can invent, does this mean the end of the patent system as we know it? The patent system, both in the US and Europe, allows companies to protect their inventions and helps foster innovation. However, Artificial Intelligence (AI) could be set to disrupt the patent system as we know it. This talk will examine how AI may change the patent landscape in the years to come. Furthermore, ways in which companies can best protect their AI related inventions will be examined from both a US and...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
Chris Matthieu is the President & CEO of Computes, inc. He brings 30 years of experience in development and launches of disruptive technologies to create new market opportunities as well as enhance enterprise product portfolios with emerging technologies. His most recent venture was Octoblu, a cross-protocol Internet of Things (IoT) mesh network platform, acquired by Citrix. Prior to co-founding Octoblu, Chris was founder of Nodester, an open-source Node.JS PaaS which was acquired by AppFog and ...
The deluge of IoT sensor data collected from connected devices and the powerful AI required to make that data actionable are giving rise to a hybrid ecosystem in which cloud, on-prem and edge processes become interweaved. Attendees will learn how emerging composable infrastructure solutions deliver the adaptive architecture needed to manage this new data reality. Machine learning algorithms can better anticipate data storms and automate resources to support surges, including fully scalable GPU-c...
Cloud-enabled transformation has evolved from cost saving measure to business innovation strategy -- one that combines the cloud with cognitive capabilities to drive market disruption. Learn how you can achieve the insight and agility you need to gain a competitive advantage. Industry-acclaimed CTO and cloud expert, Shankar Kalyana presents. Only the most exceptional IBMers are appointed with the rare distinction of IBM Fellow, the highest technical honor in the company. Shankar has also receive...