1

I've got Mutt to access and read my gmail, but in the inbox, it includes all the mail that the gmail interface hides in two tabs (I think they're called labels) called 'Social' and 'Promotions'.

I'd like to make the switch to a console only mail interface, but seeing all these extra spammy emails is unbearable! I'm a little foggy on the options available for handling this considering I'm using IMAP and not POP...Also, I don't believe I'm pulling in these messages locally for something like Spamassassin to help with.

Ideally, I'd like to access the mail, sort it and trash the spam, and then show a cleaned up inbox in Mutt that is also reflected on the gmail servers.

I've looked through a number of different pages online, but all that are releated to something like fetchmail, procmail, and especially Spamassassin seem to be related to the subject of running your own mailserver (not using a hosted mail server). The manual for Mutt is like reading a book on brain surgery for me, and I'm not sure where to go for what seems like a solution that I would think a lot of people would have...How to clean up Gmail when using Mutt.

I've attached my muttrc, a .procmail and a .forward...I've also installed spamassassin from the Arch repositories, but I'm not sure where to point it or how to ensure that I've got this system integration even staged right at this point.

Any help is appreciated.

set ssl_starttls=yes
set ssl_force_tls=yes
set imap_user = 'XXXXXXXX@gmail.com'
set imap_pass = 'XXXXXXXXX'
set from='XXXXXXXXXX@gmail.com'
set realname='XXXXXXXXX'
set folder = imaps://imap.gmail.com/
set spoolfile = imaps://imap.gmail.com/INBOX
set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"
set header_cache = "~/.mutt/cache/headers"
set message_cachedir = "~/.mutt/cache/bodies"
set certificate_file = "~/.mutt/certificates"
set smtp_url = 'smtps:// XXXXXXXXXX@gmail.com:XXXXXXXXXXX@smtp.gmail.com:465/'
set move = no
set imap_keepalive = 900
mailboxes +GMail/INBOX +GMail/Social +GMail/Promotions
set sort=threads
set sort_browser=date
set sort_aux=reverse-last-date-received
set editor=nvim


source ~/.mutt/mutt-colors-solarized/mutt-colors-solarized-light-256.muttrc



# Sanely handle multi-part messages (prefer text part, but yield to
# mailcap-configured rendering for html-only)
alternative_order text/plain text/html
auto_view text/html

set sleep_time = 0

bind pager j next-line
bind pager k previous-line
bind attach,index,pager \CD next-page
bind attach,index,pager \CU previous-page
bind pager g top
bind pager G bottom
bind attach,index g first-entry
bind attach,index G last-entry

Here's the ~/.procmail

# SpamAssassin sample procmailrc
#
# Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc'
# if you use the spamc/spamd combination)
#
# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
#
# The lock file ensures that only 1 spamassassin invocation happens
# at 1 time, to keep the load down.
#
:0fw: spamassassin.lock
* < 256000
| spamassassin

# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mbox. (This one is optional.)
:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
almost-certainly-spam

# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to "probably-spam".
:0:
* ^X-Spam-Status: Yes
probably-spam

# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped.  This will re-add it.
:0
* ^^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "

  :0 fhw
  | sed -e '1s/^/F/'
}

Do I need to pull messages down locally and run them here? I'm so confused, but I know one thing...I'm doing a couple of things very wrong.

Thanks for all your help!

  • 1
    Is the issue really spam or more promotions and whatnot that you don't really want to see every day? I'd use notmuch tagging to emulate gmail's tabs. – Amanda Apr 1 '16 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.