Welcome!

Linux Containers Authors: Yeshim Deniz, Liz McMillan, Zakia Bouachraoui, Elizabeth White, 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
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
Digital Transformation is much more than a buzzword. The radical shift to digital mechanisms for almost every process is evident across all industries and verticals. This is often especially true in financial services, where the legacy environment is many times unable to keep up with the rapidly shifting demands of the consumer. The constant pressure to provide complete, omnichannel delivery of customer-facing solutions to meet both regulatory and customer demands is putting enormous pressure on...
IoT is rapidly becoming mainstream as more and more investments are made into the platforms and technology. As this movement continues to expand and gain momentum it creates a massive wall of noise that can be difficult to sift through. Unfortunately, this inevitably makes IoT less approachable for people to get started with and can hamper efforts to integrate this key technology into your own portfolio. There are so many connected products already in place today with many hundreds more on the h...
The standardization of container runtimes and images has sparked the creation of an almost overwhelming number of new open source projects that build on and otherwise work with these specifications. Of course, there's Kubernetes, which orchestrates and manages collections of containers. It was one of the first and best-known examples of projects that make containers truly useful for production use. However, more recently, the container ecosystem has truly exploded. A service mesh like Istio addr...
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
Charles Araujo is an industry analyst, internationally recognized authority on the Digital Enterprise and author of The Quantum Age of IT: Why Everything You Know About IT is About to Change. As Principal Analyst with Intellyx, he writes, speaks and advises organizations on how to navigate through this time of disruption. He is also the founder of The Institute for Digital Transformation and a sought after keynote speaker. He has been a regular contributor to both InformationWeek and CIO Insight...
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...
To Really Work for Enterprises, MultiCloud Adoption Requires Far Better and Inclusive Cloud Monitoring and Cost Management … But How? Overwhelmingly, even as enterprises have adopted cloud computing and are expanding to multi-cloud computing, IT leaders remain concerned about how to monitor, manage and control costs across hybrid and multi-cloud deployments. It’s clear that traditional IT monitoring and management approaches, designed after all for on-premises data centers, are falling short in ...
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...
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...