Welcome!

Linux Containers Authors: Liz McMillan, Elizabeth White, Yeshim Deniz, Zakia Bouachraoui, 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
Early Bird Registration Discount Expires on August 31, 2018 Conference Registration Link ▸ HERE. Pick from all 200 sessions in all 10 tracks, plus 22 Keynotes & General Sessions! Lunch is served two days. EXPIRES AUGUST 31, 2018. Ticket prices: ($1,295-Aug 31) ($1,495-Oct 31) ($1,995-Nov 12) ($2,500-Walk-in)
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 settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
Nicolas Fierro is CEO of MIMIR Blockchain Solutions. He is a programmer, technologist, and operations dev who has worked with Ethereum and blockchain since 2014. His knowledge in blockchain dates to when he performed dev ops services to the Ethereum Foundation as one the privileged few developers to work with the original core team in Switzerland.
René Bostic is the Technical VP of the IBM Cloud Unit in North America. Enjoying her career with IBM during the modern millennial technological era, she is an expert in cloud computing, DevOps and emerging cloud technologies such as Blockchain. Her strengths and core competencies include a proven record of accomplishments in consensus building at all levels to assess, plan, and implement enterprise and cloud computing solutions. René is a member of the Society of Women Engineers (SWE) and a m...
Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
The challenges of aggregating data from consumer-oriented devices, such as wearable technologies and smart thermostats, are fairly well-understood. However, there are a new set of challenges for IoT devices that generate megabytes or gigabytes of data per second. Certainly, the infrastructure will have to change, as those volumes of data will likely overwhelm the available bandwidth for aggregating the data into a central repository. Ochandarena discusses a whole new way to think about your next...
CloudEXPO | DevOpsSUMMIT | DXWorldEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
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...
All in Mobile is a place where we continually maximize their impact by fostering understanding, empathy, insights, creativity and joy. They believe that a truly useful and desirable mobile app doesn't need the brightest idea or the most advanced technology. A great product begins with understanding people. It's easy to think that customers will love your app, but can you justify it? They make sure your final app is something that users truly want and need. The only way to do this is by ...
DXWorldEXPO LLC announced today that Big Data Federation to Exhibit at the 22nd International CloudEXPO, colocated with DevOpsSUMMIT and DXWorldEXPO, November 12-13, 2018 in New York City. Big Data Federation, Inc. develops and applies artificial intelligence to predict financial and economic events that matter. The company uncovers patterns and precise drivers of performance and outcomes with the aid of machine-learning algorithms, big data, and fundamental analysis. Their products are deployed...