Welcome!

Linux Containers Authors: Liz McMillan, Elizabeth White, AppDynamics Blog, Stackify Blog, 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
IT professionals are also embracing the reality of Serverless architectures, which are critical to developing and operating real-time applications and services. Serverless is particularly important as enterprises of all sizes develop and deploy Internet of Things (IoT) initiatives. Serverless and Kubernetes are great examples of continuous, rapid pace of change in enterprise IT. They also raise a number of critical issues and questions about employee training, development processes, and opera...
This month @nodexl announced that ServerlessSUMMIT & DevOpsSUMMIT own the world's top three most influential Kubernetes domains which are more influential than LinkedIn, Twitter, YouTube, Medium, Infoworld and Microsoft combined. NodeXL is a template for Microsoft® Excel® (2007, 2010, 2013 and 2016) on Windows (XP, Vista, 7, 8, 10) that lets you enter a network edge list into a workbook, click a button, see a network graph, and get a detailed summary report, all in the familiar environment of...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
AI and machine learning disruption for Enterprises started happening in the areas such as IT operations management (ITOPs) and Cloud management and SaaS apps. In 2019 CIOs will see disruptive solutions for Cloud & Devops, AI/ML driven IT Ops and Cloud Ops. Customers want AI-driven multi-cloud operations for monitoring, detection, prevention of disruptions. Disruptions cause revenue loss, unhappy users, impacts brand reputation etc.
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
Atmosera delivers modern cloud services that maximize the advantages of cloud-based infrastructures. Offering private, hybrid, and public cloud solutions, Atmosera works closely with customers to engineer, deploy, and operate cloud architectures with advanced services that deliver strategic business outcomes. Atmosera's expertise simplifies the process of cloud transformation and our 20+ years of experience managing complex IT environments provides our customers with the confidence and trust tha...
The Japan External Trade Organization (JETRO) is a non-profit organization that provides business support services to companies expanding to Japan. With the support of JETRO's dedicated staff, clients can incorporate their business; receive visa, immigration, and HR support; find dedicated office space; identify local government subsidies; get tailored market studies; and more.
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
As you know, enterprise IT conversation over the past year have often centered upon the open-source Kubernetes container orchestration system. In fact, Kubernetes has emerged as the key technology -- and even primary platform -- of cloud migrations for a wide variety of organizations. Kubernetes is critical to forward-looking enterprises that continue to push their IT infrastructures toward maximum functionality, scalability, and flexibility. As they do so, IT professionals are also embr...
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...