aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2015-02-03 13:58:25 +0800
committerAaron LI <aaronly.me@outlook.com>2015-02-03 13:58:25 +0800
commit158883aba19b1dced08ad02cb87bd07cb90dfb0c (patch)
treee7b3b4817e062ded9c9384170bbdabd3f8c000f6
parent5d92d1ede1d4b6945dde4019400b86c34e4466d5 (diff)
downloaddotfiles-158883aba19b1dced08ad02cb87bd07cb90dfb0c.tar.bz2
Updated configs of offlineimap, msmtp. Added notmuch-config.
-rw-r--r--.gitignore105
-rw-r--r--.msmtprc131
-rw-r--r--.mutt/mailboxes1
-rw-r--r--.notmuch-config93
-rw-r--r--.offlineimap/offlineimap.py17
-rwxr-xr-x.offlineimap/postsync.sh26
-rw-r--r--.offlineimaprc301
7 files changed, 515 insertions, 159 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e625812
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,105 @@
+## .gitignore
+
+*~
+*.swp
+*.orig
+
+## vifm
+.vifm/Trash/
+.vifm/vifminfo
+
+## mpd
+.mpd/
+
+## ncmpcpp
+.ncmpcpp/*.log
+
+## lftp
+.lftp/*_history
+.lftp/*_log
+
+## urxvt
+.urxvt/*urxvtd*
+
+## i3
+.i3/*.sock
+
+### .config {{{
+# .config/fcitx
+.config/fcitx/clipboard/
+.config/fcitx/data
+.config/fcitx/dbus
+.config/fcitx/log
+.config/fcitx/pinyin
+.config/fcitx/table
+
+### .config }}}
+
+### C {{{
+# Object files
+*.o
+*.ko
+*.obj
+*.elf
+
+# Libraries
+*.lib
+*.a
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+### C }}}
+
+### python
+__pycache__/
+*.py[cod]
+
+### private {{{
+# ssh
+.ssh/
+
+# abook
+.abook/address*
+
+# msmtp
+.msmtp/
+
+# offlineimap
+.offlineimap/Account-*
+.offlineimap/Repository-*
+.offlineimap/*.gpg
+.offlineimap/*.log
+.offlineimap/*.crt
+.offlineimap/*pid
+.offlineimap/*lock
+
+# mutt
+.mutt/aliases
+.mutt/certificates
+.mutt/history
+.mutt/mailboxes*
+.mutt/signature
+.mutt/accounts/
+.mutt/cache/
+.mutt/tmp/
+
+# todo
+.todo/todo.txt
+.todo/todo.txt.bak
+.todo/done.txt
+.todo/report.txt
+
+.netrc
+### private }}}
+
diff --git a/.msmtprc b/.msmtprc
index b73f2bb..9c08789 100644
--- a/.msmtprc
+++ b/.msmtprc
@@ -1,56 +1,79 @@
-#
-# msmtp configuration file
-#
-# LIweitiaNux
-# February 6, 2012
-#
-# Ref: http://pbrisbin.com/posts/two_accounts_in_mutt
-#
-
-### Accounts will inherit settings from this section
+##
+## msmtp configuration
+## ~/.msmtprc
+##
+## Weitian LI <liweitianux@gmail.com>
+## 2015/02/01
+##
+## Reference:
+## [1] ArchWiki - msmtp
+## https://wiki.archlinux.org/index.php/Msmtp
+##
+
+# SMTP: 25
+# SSL: 465
+# TLS: 587
+
+### Set default values for all following accounts.
defaults
-auth on
-tls on
-tls_starttls on
-#tls_trust_file /usr/local/share/certs/ca-root-nss.crt
-tls_trust_file /etc/ssl/certs/ca-certificates.crt
-protocol smtp
-logfile ~/.msmtp/msmtp.log
-
-# SSL: 465
-# TLS: 587
-
-### autistici
-account autistici
-host smtp.autistici.org
-port 587
-tls_trust_file ~/.msmtp/autistici_ca.crt
-tls_certcheck on
-#auto_from on
-from liweitianux@autistici.org
-user liweitianux@autistici.org
-passwordeval gpg -d ~/.msmtp/autistici.gpg
-#password password
-
-### gmail
-account gmail
-host smtp.gmail.com
-port 587
-from Weitian LI
-user liweitianux@gmail.com
-#passwordeval gpg -d ~/.msmtp/gmail.gpg
-#password password
-
-### lavabit
-account lavabit
-host smtp.lavabit.com
-port 587
-from Weitian LI
-user liweitianux
-#passwordeval gpg -d ~/.msmtp/lavabit.gpg
-#password passwod
-
-
-### set a default account
-account default : autistici
+auth on
+port 587
+tls on
+tls_starttls on
+tls_certcheck on
+tls_trust_file ~/.offlineimap/ca-certificates.crt
+logfile ~/.msmtp/msmtp.log
+
+
+### Gmail - aaronly.me ###
+account gmail-aly
+host smtp.gmail.com
+from aaronly.me@gmail.com
+user aaronly.me@gmail.com
+passwordeval gpg2 --quiet --for-your-eyes-only --no-tty --decrypt ~/.offlineimap/gmail-aly.gpg
+
+
+### Outlook - aaronly.me ###
+account outlook-aly
+host smtp-mail.outlook.com
+from aaronly.me@outlook.com
+user aaronly.me@outlook.com
+passwordeval gpg2 --quiet --for-your-eyes-only --no-tty --decrypt ~/.offlineimap/outlook-aly.gpg
+
+
+### Outlook - liweitianux ###
+account outlook-li
+host smtp-mail.outlook.com
+from liweitianux@live.com
+user liweitianux@live.com
+passwordeval gpg2 --quiet --for-your-eyes-only --no-tty --decrypt ~/.offlineimap/outlook-li.gpg
+
+
+### SJTU - liweitianux ###
+account sjtu
+host smtp.sjtu.edu.cn
+from liweitianux@sjtu.edu.cn
+user liweitianux@sjtu.edu.cn
+passwordeval gpg2 --quiet --for-your-eyes-only --no-tty --decrypt ~/.offlineimap/sjtu.gpg
+
+
+### Gmail - liweitianux ###
+account gmail-li
+host smtp.gmail.com
+from liweitianux@gmail.com
+user liweitianux@gmail.com
+passwordeval gpg2 --quiet --for-your-eyes-only --no-tty --decrypt ~/.offlineimap/gmail-li.gpg
+
+
+### Autistici ###
+account autistici
+host smtp.autistici.org
+tls_trust_file ~/.offlineimap/autistici_ca.crt
+from liweitianux@autistici.org
+user liweitianux@autistici.org
+passwordeval gpg2 --quiet --for-your-eyes-only --no-tty --decrypt ~/.offlineimap/autistici.gpg
+
+
+### Set the default account ###
+account default : outlook-aly
diff --git a/.mutt/mailboxes b/.mutt/mailboxes
deleted file mode 100644
index 1f5948f..0000000
--- a/.mutt/mailboxes
+++ /dev/null
@@ -1 +0,0 @@
-mailboxes "+autistici/Drafts" "+autistici/INBOX" "+autistici/Sent" "+autistici/Spam" "+autistici/Trash"
diff --git a/.notmuch-config b/.notmuch-config
new file mode 100644
index 0000000..ba7e7b2
--- /dev/null
+++ b/.notmuch-config
@@ -0,0 +1,93 @@
+##
+## Configuration file for the notmuch mail system
+## ~/.notmuch-config
+## http://notmuchmail.org
+##
+## Weitian LI <liweitianux@gmail.com>
+## 2015/02/02
+##
+
+# Database configuration
+#
+# The only value supported here is 'path' which should be the top-level
+# directory where your mail currently exists and to where mail will be
+# delivered in the future. Files should be individual email messages.
+# Notmuch will store its database within a sub-directory of the path
+# configured here named ".notmuch".
+#
+[database]
+path=/home/aly/Mail
+
+# User configuration
+#
+# Here is where you can let notmuch know how you would like to be
+# addressed. Valid settings are
+#
+# name Your full name.
+# primary_email Your primary email address.
+# other_email A list (separated by ';') of other email addresses
+# at which you receive email.
+#
+# Notmuch will use the various email addresses configured here when
+# formatting replies. It will avoid including your own addresses in the
+# recipient list of replies, and will set the From address based on the
+# address to which the original email was addressed.
+#
+[user]
+name=Aaron LI
+primary_email=aaronly.me@outlook.com
+other_email=aaronly.me@gmail.com;liweitianux@autistici.org;liweitianux@gmail.com;liweitianux@live.com;
+
+# Configuration for "notmuch new"
+#
+# The following options are supported here:
+#
+# tags A list (separated by ';') of the tags that will be
+# added to all messages incorporated by "notmuch new".
+#
+# ignore A list (separated by ';') of file and directory names
+# that will not be searched for messages by "notmuch new".
+#
+# NOTE: *Every* file/directory that goes by one of those
+# names will be ignored, independent of its depth/location
+# in the mail store.
+#
+[new]
+tags=unread;inbox;
+ignore=
+
+# Search configuration
+#
+# The following option is supported here:
+#
+# exclude_tags
+# A ;-separated list of tags that will be excluded from
+# search results by default. Using an excluded tag in a
+# query will override that exclusion.
+#
+[search]
+exclude_tags=deleted;spam;
+
+# Maildir compatibility configuration
+#
+# The following option is supported here:
+#
+# synchronize_flags Valid values are true and false.
+#
+# If true, then the following maildir flags (in message filenames)
+# will be synchronized with the corresponding notmuch tags:
+#
+# Flag Tag
+# ---- -------
+# D draft
+# F flagged
+# P passed
+# R replied
+# S unread (added when 'S' flag is not present)
+#
+# The "notmuch new" command will notice flag changes in filenames
+# and update tags, while the "notmuch tag" and "notmuch restore"
+# commands will notice tag changes and update flags in filenames
+#
+[maildir]
+synchronize_flags=true
diff --git a/.offlineimap/offlineimap.py b/.offlineimap/offlineimap.py
index 50f91e2..e3ae422 100644
--- a/.offlineimap/offlineimap.py
+++ b/.offlineimap/offlineimap.py
@@ -1,8 +1,7 @@
#!/usr/bin/env python
#
-# Ref:
-# Encrypt OfflineIMAP Password
-# http://unix.stackexchange.com/questions/44214/encrypt-offlineimap-password
+# Add support of encrypting password with gpg2 for OfflineIMAP.
+# Provide function 'mailpasswd' to decrypt the password.
#
# Configurations:
# [general]
@@ -12,7 +11,11 @@
# remotepasseval = mailpasswd("<accountname>")
# ...
#
-# 2014/06/20
+# Reference:
+# [1] Encrypt OfflineIMAP Password
+# http://unix.stackexchange.com/questions/44214/encrypt-offlineimap-password
+#
+# Updated: 2015/02/02
#
import os
@@ -21,7 +24,8 @@ import subprocess
def mailpasswd(account):
account = os.path.basename(account)
path = '{0}/.offlineimap/{1}.gpg'.format(os.environ['HOME'], account)
- args = ['gpg', '--use-agent', '--quiet', '--batch', '-d', path]
+ args = ['gpg2', '--for-your-eyes-only', '--no-tty',
+ '--quiet', '--batch', '--decrypt', path]
try:
return subprocess.check_output(args).strip()
except subprocess.CalledProcessError:
@@ -32,7 +36,8 @@ def mailpasswd(account):
#def mailpasswd(account):
# account = os.path.basename(account)
# path = '{0}/.offlineimap/{1}.gpg'.format(os.environ['HOME'], account)
-# args = ['gpg', '--use-agent', '--quiet', '--batch', '-d', path]
+# args = ['gpg2', '--for-your-eyes-only', '--no-tty',
+# '--quiet', '--batch', '--decrypt', path]
# proc = subprocess.Popen(args, stdout=subprocess.PIPE)
# output = proc.communicate()[0].strip()
# retcode = proc.wait()
diff --git a/.offlineimap/postsync.sh b/.offlineimap/postsync.sh
new file mode 100755
index 0000000..c5a3985
--- /dev/null
+++ b/.offlineimap/postsync.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# OfflineIMAP postsynchook
+#
+# Weitian LI
+# 2015/02/02
+#
+
+## Check new mails & send notification
+MAILDIR="${HOME}/Mail/"
+newmails=0
+for d in `find ${MAILDIR} -maxdepth 2 -type d -iname '*inbox'`; do
+ n=`ls ${d}/new/ | wc -l`
+ newmails=`expr ${newmails} + ${n}`
+done
+
+if [ ${newmails} -gt 0 ] && which notify-send >/dev/null 2>&1; then
+ export DISPLAY=":0"
+ export XAUTHORITY="${HOME}/.Xauthority"
+ notify-send -i 'mail-unread' -a "OfflineIMAP" \
+ "OfflineIMAP: Received ${newmails} new mail(s)!"
+fi
+
+## Invoke notmuch to index mails
+notmuch new
+
diff --git a/.offlineimaprc b/.offlineimaprc
index 11b7f3c..9799647 100644
--- a/.offlineimaprc
+++ b/.offlineimaprc
@@ -1,113 +1,218 @@
+##
+## OfflineIMAP Configuration
+## ~/.offlineimaprc
+##
+## Weitian LI <liweitianux@gmail.com>
+## 2015/02/03
+##
+## Reference:
+## [1] ArchWiki - OfflineIMAP
+## https://wiki.archlinux.org/index.php/OfflineIMAP
+##
+
+[general]
+# Function 'mailpasswd': invoke gpg to decrypt passwords.
+pythonfile = ~/.offlineimap/offlineimap.py
#
-# offlineimap configuration file
+# List of accounts to be synced, separated by a comma.
+accounts = gmail-aly, gmail-li, outlook-aly, outlook-li, sjtu, autistici
+#accounts = outlook-aly, outlook-li, sjtu, autistici
+#
+# Control how many accuonts may be synced simulaneously
+# NOTE: if you are using autorefresh and have more than one account,
+# your must set this number to be >= to the number of accounts you
+# have; since any given sync run never "finishes" due to a timer,
+# you will never sync your additional accounts if this is 1.
+maxsyncaccounts = 6
#
-# LIweitiaNux
-# February 6, 2012
+# UI: blinkenlights, ttyui, quiet (suppress anything but errors)
+ui = TTY.TTYUI, Noninteractive.Basic, Noninteractive.Quiet
+
+
+[Account example]
+localrepository = example-local
+remoterepository = example-remote
+# Status cache
+status_backend = sqlite
+# Minutes between sycns
+autorefresh = 15
+# Number of quick-syncs between autorefreshes.
+# Quick-syncs do not update if the only changes were to IMAP flags.
+quick = 5
+# pre and post sync hook to execute a external command.
+#presynchook = imapfilter
+#postsynchook = ~/.offlineimap/postsync.sh
#
-# Ref: http://pbrisbin.com/posts/two_accounts_in_mutt
+[Repository example-local]
+type = Maildir
+localfolders = ~/Mail/example
#
+[Repository example-remote]
+# Remote repository can be IMAP or Gmail
+type = IMAP
+remotehost = imap.example.com
+ssl = yes
+sslcacertfile = ~/.offlineimap/ca-certificates.crt
+remoteport = 993
+remoteuser = username@example.com
+#remotepass = password
+remotepasseval = mailpasswd("example")
+# Hold the connection open, instead of closing the connection once
+# a sync is complete. (unit: seconds)
+keepalive = 60
+# Keep connection open between refreshes.
+holdconnectionopen = yes
-[general]
-# mailpasswd
-pythonfile = ~/.offlineimap/offlineimap.py
-# This should contain a comma delimited list of all
-# identifiers of the accounts that are to be synced
-#accounts = gmail, lavabit
-accounts = autistici
-# Control how many accuonts may be synced simulaneously
-maxsyncaccounts = 1
-# UI, NOTE: cron job calls the quiet UI with -u
-#ui = blinkenlights
-ui = ttyui
-#ui = quiet # This will suppress anything but errors
+
+[Account gmail-aly]
+localrepository = gmail-aly-local
+remoterepository = gmail-aly-remote
+status_backend = sqlite
+autorefresh = 30
+quick = 5
+postsynchook = ~/.offlineimap/postsync.sh
+#
+[Repository gmail-aly-local]
+type = Maildir
+localfolders = ~/Mail/gmail-aly
+#
+[Repository gmail-aly-remote]
+type = Gmail
+remoteuser = aaronly.me@gmail.com
+remotepasseval = mailpasswd("gmail-aly")
+keepalive = 60
+holdconnectionopen = yes
+sslcacertfile = ~/.offlineimap/ca-certificates.crt
+# Not sync the 'All Mail' folder
+folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail']
+
+
+[Account gmail-li]
+localrepository = gmail-li-local
+remoterepository = gmail-li-remote
+status_backend = sqlite
+autorefresh = 15
+quick = 5
+postsynchook = ~/.offlineimap/postsync.sh
+#
+[Repository gmail-li-local]
+type = Maildir
+localfolders = ~/Mail/gmail-li
+#
+[Repository gmail-li-remote]
+type = Gmail
+remoteuser = liweitianux@gmail.com
+remotepasseval = mailpasswd("gmail-li")
+keepalive = 60
+holdconnectionopen = yes
+sslcacertfile = ~/.offlineimap/ca-certificates.crt
+# Not sync the 'All Mail' folder
+folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail']
+
+
+[Account outlook-aly]
+localrepository = outlook-aly-local
+remoterepository = outlook-aly-remote
+status_backend = sqlite
+autorefresh = 30
+quick = 5
+postsynchook = ~/.offlineimap/postsync.sh
+#
+[Repository outlook-aly-local]
+type = Maildir
+localfolders = ~/Mail/outlook-aly
+#
+[Repository outlook-aly-remote]
+type = IMAP
+remotehost = imap-mail.outlook.com
+ssl = yes
+sslcacertfile = ~/.offlineimap/ca-certificates.crt
+remoteport = 993
+remoteuser = aaronly.me@outlook.com
+remotepasseval = mailpasswd("outlook-aly")
+keepalive = 60
+holdconnectionopen = yes
+
+
+[Account outlook-li]
+localrepository = outlook-li-local
+remoterepository = outlook-li-remote
+status_backend = sqlite
+autorefresh = 15
+quick = 5
+postsynchook = ~/.offlineimap/postsync.sh
+#
+[Repository outlook-li-local]
+type = Maildir
+localfolders = ~/Mail/outlook-li
+#
+[Repository outlook-li-remote]
+type = IMAP
+remotehost = imap-mail.outlook.com
+ssl = yes
+sslcacertfile = ~/.offlineimap/ca-certificates.crt
+remoteport = 993
+remoteuser = liweitianux@live.com
+remotepasseval = mailpasswd("outlook-li")
+keepalive = 60
+holdconnectionopen = yes
+
+
+[Account sjtu]
+localrepository = sjtu-local
+remoterepository = sjtu-remote
+status_backend = sqlite
+autorefresh = 15
+quick = 5
+postsynchook = ~/.offlineimap/postsync.sh
+#
+[Repository sjtu-local]
+type = Maildir
+localfolders = ~/Mail/sjtu
+#
+[Repository sjtu-remote]
+type = IMAP
+remotehost = imap.sjtu.edu.cn
+ssl = yes
+sslcacertfile = ~/.offlineimap/ca-certificates.crt
+remoteport = 993
+remoteuser = liweitianux@sjtu.edu.cn
+remotepasseval = mailpasswd("sjtu")
+keepalive = 60
+holdconnectionopen = yes
[Account autistici]
-localrepository = autistici-local
-remoterepository = autistici-remote
-#autorefresh = 10
+localrepository = autistici-local
+remoterepository = autistici-remote
+status_backend = sqlite
+autorefresh = 60
+quick = 5
+postsynchook = ~/.offlineimap/postsync.sh
#
[Repository autistici-local]
-type = Maildir
-localfolders = ~/Maildir/autistici
+type = Maildir
+localfolders = ~/Mail/autistici
#
[Repository autistici-remote]
-type = IMAP
-remotehost = mail.autistici.org
-ssl = yes
-#cert_fingerprint = eea375e1c67a1464ecc6c3a7e6ca9596d1c2dae5
-sslcacertfile = ~/.msmtp/autistici_ca.crt
-remoteport = 993
-remoteuser = liweitianux@autistici.org
-#remotepass = password
-remotepasseval = mailpasswd("autistici")
-
-
-[Account gmail]
-# The identifier for the local repository; e.g., the
-# maildir that offlineimap will sync with an IMAP server
-localrepository = gmail-local
-# The identifier for the remote repository. This is
-# the actual IMAP, which is usually foreign to the system
-remoterepository = gmail-remote
-# Minutes between syncs
-#autorefresh = 10
-# Number of quick-syncs between autorefreshes. Quick-syncs
-# do not update if the only changes were to IMAP flags
-#quick = 10
-
-[Repository gmail-local]
-# offlineimap now only supports Maildir and IMAP for local repositories
-type = Maildir
-localfolders = ~/Maildir/gmail
-
-[Repository gmail-remote]
-# Remote repository can be IMAP or Gmail
-type = Gmail
-remotehost = imap.gmail.com
-ssl = yes
-remoteport = 993
-#remoteuser = username
-#remotepass = password
-nametrans = lambda foldername: re.sub ('^\[gmail\]', 'bak',
- re.sub ('sent_mail', 'sent',
- re.sub ('starred', 'flagged',
- re.sub (' ', '_', foldername.lower()))))
-folderfilter = lambda foldername: foldername not in '[Gmail]/All Mail'
-# Instead of closing the connection once a sync is complete,
-# offlineimap will send empty data to the server to hold the
-# connection open. A value of 60 attempts to hold the connection
-# for a minute between syncs (both quick and autorefresh)
-#keepalive = 60
-
-
-[Account lavabit]
-localrepository = lavabit-local
-remoterepository = lavabit-remote
-#autorefresh = 10
-#quick = 10
-
-[Repository lavabit-local]
-type = Maildir
-localfolders = ~/Maildir/lavabit
-
-[Repository lavabit-remote]
-type = IMAP
-remotehost = imap.lavabit.com
-ssl = yes
-remoteport = 993
-#remoteuser = username
-#remotepass = password
-
-
-# Generate a muttrc fragment containing the mailboxes
-# that it syncs
+type = IMAP
+remotehost = mail.autistici.org
+ssl = yes
+sslcacertfile = ~/.offlineimap/autistici_ca.crt
+remoteport = 993
+remoteuser = liweitianux@autistici.org
+remotepasseval = mailpasswd("autistici")
+keepalive = 60
+holdconnectionopen = yes
+
+
+# Generate a muttrc fragment containing the mailboxes that it syncs.
# NOTE: add "source ~/.mutt/mailboxes" to "muttrc"
[mbnames]
-enabled = yes
-filename = ~/.mutt/mailboxes
-header = "mailboxes "
-peritem = "+%(accountname)s/%(foldername)s"
-sep = " "
-footer = "\n"
+enabled = yes
+filename = ~/.mutt/mailboxes.offlineimap
+header = "mailboxes "
+peritem = "+%(accountname)s/%(foldername)s"
+sep = " "
+footer = "\n"