Skip to content

Instantly share code, notes, and snippets.

@mashdot
Created May 6, 2012 14:27
Show Gist options
  • Save mashdot/2622521 to your computer and use it in GitHub Desktop.
Save mashdot/2622521 to your computer and use it in GitHub Desktop.
mutt + offlineimap + msmtp +msmtpQ
 Author....: 'Mash (Thomas Herbert)
alias mash "'Mash (Thomas Herbert)" <[email protected]>
text/html; w3m -dump %s; nametemplate=%s.html; copiousoutput
text/xhtml; w3m -dump %s; nametemplate=%s.html; copiousoutput
#Time-stamp: <2012-05-06 Sun 16:07 msmtprc>
# This file must have no more than user read/write permissions.
account work
host mail.work.net
user [email protected]
password password
auto_from off
from [email protected]
maildomain work.net
#tls on
#tls_starttls on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp-work.log
account personal
host mail.personal.net
port 587
timeout 30
auth on
user [email protected]
password password
auto_from off
from [email protected]
maildomain personal.net
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp-personal.log
account default: personal
# Time-stamp: <2012-05-06 Sun 20:00 muttrc>
# Keybindings
bind pager . sync-mailbox
bind index . sync-mailbox
bind index B bounce-message
bind pager B bounce-message
macro index wi "<change-folder>/home/someone/mail/work/inbox<enter>" "Go to work inbox"
macro index hi "<change-folder>/home/someone/mail/personal/inbox<enter>" "Go to personal inbox"
# Read account configuration on folder change:
folder-hook ~/mail/work/* source ~/mutt/work.muttrc
folder-hook ~/mail/personal/* source ~/mutt/personal.muttrc
# Mailboxes
set mbox_type = Maildir
# default
set folder = ~/mail
set spoolfile = ~/mail/work/inbox
set record = ~/mail/work/sent
set postponed = ~/mail/work/drafts
# Mail lists
subscribe [email protected]
set followup_to = no
set honor_followup_to = no
# Setup
set mail_check = 1 # minimum time between scans
set timeout = 3 # idle time before scanning
set beep_new # bell on new mails
set status_on_top
# status bar top
# default %4C %Z %{%b %d} %-15.15L (%4l) %s . Optional: "%3C [%Z] %D %-15.15F %s"
set index_format = "%4C %2N %Z %{%b %d %H:%M} %-30.30L (%4c) %?y?[%.20Y] ?%s"
set date_format = "!%Y-%m-%d %R%Z" # use iso8601 happy dates. Optional: "%m/%d/%y at %I:%M%P"
set pipe_decode # strip headers and eval mimes when piping
set thorough_search # strip headers and eval mimes before searching
set mailcap_path = ~/mutt/mailcap
# Header display
ignore * # ignore all headers
unignore date time from subject to cc # header order
unhdr_order * # reset header order
hdr_order From: Date: To: Cc: Bcc: Subject: # new header order
# Alias (Address book)
set alias_file = ~/mutt/alias
set alias_format = "%4n %t %-20a %r"
set sort_alias = alias # sort alias file by alias
set reverse_alias # show names from alias file in index
source $alias_file # needed apparently
# Index options
set sort = threads # set sort=reverse-threads
#set sort_aux = reverse-score # aux sorting method, threads with highest score on bottom
folder-hook inbox set sort = threads
folder-hook sent set sort = reverse-date
# Pager options
#set pager_index_lines = 10 # number of index lines to show
#set pager_context = 5 # number of context lines to show
set pager_stop # don't go to next message automatically
set ascii_chars = yes # use ASCII arrows
set wrap = 150
set smart_wrap = yes # don't split words
set markers = no # supress "+" on wrapped lines
set menu_scroll # scroll in menus
set implicit_autoview # view html email
auto_view text/html # view html automatically
alternative_order text/plain text/enriched text/html # save html for last
set auto_tag = yes # tags
set mark_old = no # don't mark messages as old if i haven't read them
set move = no # move read messages
set noconfirmappend # don't ask me if i want to append to mailboxes
set nohelp # don't show the help line at the top
# Composing
set editor = "emacsclient"
set sig_dashes # dashes before my sig
# Sending
set askcc # ask for CC:
set fcc_attach # save attachments with the body
set sendmail_wait = -1 # don't wait for sending to complete
set abort_nosubject = no # send without subject
set abort_unmodified = yes # allow sending of unmodified messages
set copy = yes # save sent messages
set fast_reply # skip to compose when replying
set include # include message in replies
set forward_quote = yes # quote email body when forwarding
set forward_format = "Fwd: %s" # format for subject when forwarding
set forward_decode # decode when forwarding
set attribution = "On %d, %n wrote:" # set the attribution
set mime_forward = ask-yes # ask to send with attachment
set postpone = ask-no # default "no" for postpone
# Scoring
set score = yes
score "~N" 2 # add point to new
score "~R" 1 # add point to read
score "~Q" 1 # add point to replied
score "~F" 10 # add point to flagged
#score "~f [email protected]" 1 # add point to from
# Colours
##### object foreground background
color index yellow default ~N # new
color index green default ~T # tagged
color index red default ~D # deleted
color index green default ~F # flagged
color attachment yellow default # MIME attachments
color bold default default # hiliting bold patterns in body
color error default default # errors
color hdrdefault default default # default header lines
color indicator black white # actual message
color markers default default # + at beginning of wrapped lines
color message default default # info messages
color normal default default # normal text
color quoted white default # quoted text
color search yellow default # search matches
color signature default default # signature
# color status magenta default # status line
color tilde default default # ~ at bottom of msg
color tree default default # thread arrows
color underline default default # hiliting underlined patterns in body
# urlview
macro index,pager \Cb ":set pipe_decode\n|urlview\n:unset pipe_decode\n"\
# mutt-patched
set sidebar_width = 15
set sidebar_visible = no
set sidebar_delim = '|'
color sidebar_new yellow default
bind pager > sidebar-next
bind index > sidebar-next
bind pager < sidebar-prev
bind index < sidebar-prev
bind pager , sidebar-open
bind index , sidebar-open
# b toggles sidebar visibility
macro index b '<enter-command>toggle sidebar_visible<enter>'
macro pager b '<enter-command>toggle sidebar_visible<enter>'
# org-mode
# kudos: http://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/
macro index \Ca "|~/mutt/remember-mail\n"
# Facebook clearup
macro index Sf '<limit>~f Facebook<enter>'
macro index Sa '<limit>all<enter>'
# PGP
# kudos http://wiki.mutt.org/?MuttGuide/UseGPG
# THIS NEEDS TO BE LOOKED AT!
#set sendmail="/home/somone/mutt/msmtp/msmtpQ" #queues mail to be sent later
# https://github.com/sercxanto/msmtpq_notify
# /usr/share/doc/msmtp/examples
# Time-stamp: <2012-05-06 Sun 16:02 offlineimaprc>
[general]
accounts = work,personal
maxsyncaccounts = 5
maxconnections = 3
ui = Noninteractive.Basic
#ui = Noninteractive.Quiet
# -------------------- Work details. --------------------
[Account work]
localrepository = work-Local
remoterepository = work-Remote
autorefresh = 0.5
quick = 10
[Repository work-Local]
type = Maildir
localfolders = ~/mail/work
[Repository work-Remote]
type = IMAP
port = 993
SSL = yes
remotehost = mail.work.net
remoteuser = [email protected]
remotepass = password
holdconnectionopen = true
keepalive = 60
# Trim "INBOX" and rename folders.
nametrans = lambda folder: re.sub('^INBOX\.', '', re.sub(' ', '-', folder.lower()))
# Filters directories.
#folderfilter = lambda foldername: foldername in ['INBOX']
#folderfilter = lambda foldername: foldername in ['INBOX', 'Sent','Deleted Items']
#folderfilter = lambda foldername: foldername not in ['Trash']
# -------------------- Personal details. --------------------
[Account personal]
localrepository = personal-Local
remoterepository = personal-Remote
autorefresh = 0.5
quick = 10
[Repository personal-Local]
type = Maildir
localfolders = ~/mail/personal
[Repository personal-Remote]
type = IMAP
remotehost = mail.personal.net
remoteuser = [email protected]
remotepass = password
holdconnectionopen = true
keepalive = 60
# Trim "INBOX" and rename folders.
nametrans = lambda folder: re.sub('^INBOX\.', '', re.sub(' ', '-', folder.lower()))
# Filters directories.
#folderfilter = lambda foldername: foldername in ['INBOX', 'Sent']
#folderfilter = lambda foldername: foldername not in ['Trash']
# Time-stamp: <2012-05-06 Sun 15:54 personal.muttrc>
unmy_hdr * # delete existing header-settings, if there are any.
my_hdr Name: Someone Something.
my_hdr X-URL: http://www.personal.net
set realname = "Someone Something"
set from = "[email protected]"
set signature = "~/mutt/personal.sig"
# Local mailboxes.
set mbox_type = Maildir
set folder = ~/mail/personal
set spoolfile = ~/mail/personal/inbox
set record = ~/mail/personal/sent
set postponed = ~/mail/personal/draft
mailboxes =inbox =sent
# Sending.
set sendmail = "/usr/bin/msmtp -a personal"
# Look
color status white red # status line
---
Someone Something.
This is the personal signature.
#!/usr/bin/perl -w
#
# Helper for mutt to remember mails in Emacs' Org mode
#
# Copyright: © 2009-2010 Stefano Zacchiroli <[email protected]>
# License: GNU General Public License (GPL), version 3 or above
#
# libmailtools-perl liburi-perl
# Example of mutt macro to invoke this hitting ESC-R (to be put in ~/.muttrc):
# macro index \eR "|~/bin/remember-mail\n"
use strict;
use Mail::Internet;
use URI::Escape;
my $msg = Mail::Internet->new(\*STDIN);
$msg->head->get('message-id') =~ /^<(.*)>$/;
my $mid = $1;
my $subject = $msg->head->get('subject') || "";
my $from = $msg->head->get('from') || "";
chomp ($subject, $from);
my $note_body = uri_escape("$subject\nFrom: $from");
exec "emacsclient", "org-protocol:/remember:/m/mutt:$mid/MAIL:/$note_body";
# Time-stamp: <2012-05-06 Sun 15:54 work.muttrc>
unmy_hdr * # delete existing header-settings, if there are any.
my_hdr Name: Someone Something
my_hdr X-URL: http://www.work.net
set realname = "Someone Something"
set from = "[email protected]"
set signature = "~/mutt/work.sig"
# Local mailboxes.
set mbox_type = Maildir
set folder = ~/mail/work
set spoolfile = ~/mail/work/inbox
set record = ~/mail/work/sent
set postponed = ~/mail/work/draft
mailboxes =inbox =sent
# Sending.
set sendmail = "/usr/bin/msmtp -a work"
# Look
color status white blue # status line
---
Someone Something.
This is the work signature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment