1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
|
##
## ~/.offlineimaprc
## OfflineIMAP configuration
##
## Reference:
## [1] OfflineIMAP documentation
## https://offlineimap.readthedocs.org/en/latest/index.html
## [2] ArchWiki - OfflineIMAP
## https://wiki.archlinux.org/index.php/OfflineIMAP
## [3] The Homely Mutt / Steve Losh
## http://stevelosh.com/blog/2012/10/the-homely-mutt/
## [4] Gmail - How actions sync in IMAP
## https://support.google.com/mail/answer/77657
## [5] Gmail - Deleting IMAP messages
## https://support.google.com/mail/answer/78755
##
## * How to rename a local OfflineIMAP managed folder
## Credits: https://www.preining.info/blog/2015/09/rename-offlineimap-folder/
##
## NOTE for Gmail labels:
## New labels must be created in remote Gmail (e.g., through the web UI),
## Otherwise, the IMAP sync will fail with error:
## 'Invalid Arguments: Label name is not allowed'
## if the new label was manually added to local messages.
##
## Aaron LI <aaronly.me@gmail.com>
## Created: 2015-02-03
## Updated: 2016-01-31
##
[general]
# Store metadata aside with maildir
metadata = ~/mail/offlineimap
# Function 'mailpasswd': invoke gpg2 to decrypt passwords.
pythonfile = ~/.offlineimap/offlineimap.py
#
# List of accounts to be synced, separated by a comma.
# accounts = gmail-aly, gmail-li, outlook-aly, outlook-li, sjtu, autistici, foxmail
accounts = gmail-aly, gmail-li, 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 = 7
#
# UI: blinkenlights, ttyui, quiet (suppress anything but errors)
ui = ttyui
[Account example] ## {{{
localrepository = example-local
remoterepository = example-remote
# Supported historical backend: plain, sqlite
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
#
[Repository example-local]
# Supported local repository types: Maildir, GmailMaildir, IMAP
type = Maildir
localfolders = ~/mail/example
# Translate local folder names to remote folder names
#nametrans = ???
#
[Repository example-remote]
# Remote repository type: IMAP, Gmail
type = IMAP
remotehost = imap.example.com
remoteport = 993
remoteuser = username@example.com
#remotepass = password
remotepasseval = mailpasswd("example")
# Which authentication/authorization mechanisms and the order should try
#auth_mechanisms = GSSAPI, CRAM-MD5, XOAUTH2, PLAIN, LOGIN
ssl = yes
sslcacertfile = ~/.private/ca-certificates.crt
#cert_fingerprint = <SHA1_40_hex_digits>[, ...]
# 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
# Disable remote folder creation to match the local repository
#createfolders = True
# Filter the IMAP folders to be sync'ed
# NOTE: operates on the *untranslated* folder name (i.e., before nametrans)
#folderfilter = ???
# Translate remote folder names to local folder names
# Do NOT forget the *reverse nametrans* for local repository
#nametrans = ???
## example }}}
[Account gmail-aly] ## {{{
localrepository = gmail-aly-local
remoterepository = gmail-aly-remote
status_backend = sqlite
# Sync GMail labels with the local repository.
synclabels = yes
# Name of the header to use for label storage.
# X-Label: space-separated
# X-Keywords: comma-separated
labelsheader = X-Keywords
autorefresh = 30
quick = 5
#postsynchook = ~/.offlineimap/postsync.sh
#
[Repository gmail-aly-local]
type = GmailMaildir
localfolders = ~/mail/gmail-aly
# Translate local folder names to remote folder names
nametrans = lambda folder: {
'inbox' : 'INBOX',
'sent' : '[Gmail]/Sent Mail',
'archive' : '[Gmail]/All Mail',
'flagged' : '[Gmail]/Starred',
'drafts' : '[Gmail]/Drafts',
'junk' : '[Gmail]/Spam',
'trash' : '[Gmail]/Trash',
}.get(folder, folder)
#
[Repository gmail-aly-remote]
type = Gmail
remoteuser = aaronly.me@gmail.com
remotepasseval = mailpasswd("gmail-aly")
# I do not use OAUTH2
auth_mechanisms = GSSAPI, CRAM-MD5, PLAIN, LOGIN
ssl = yes
sslcacertfile = ~/.private/ca-certificates.crt
# Validity: Mar 2 11:00:00 2016 GMT - May 31 00:00:00 2016 GMT
#cert_fingerprint = c1a3bb1a8617af4a28ee2e0cd494533c3cd70bf8
keepalive = 60
holdconnectionopen = yes
# Filter the IMAP folders to be sync'ed
# NOTE: operates on the *untranslated* folder name (i.e., before nametrans)
#folderfilter = lambda folder: folder in [
# 'INBOX', '[Gmail]/Sent Mail', '[Gmail]/All Mail',
# '[Gmail]/Starred', '[Gmail]/Drafts',
# '[Gmail]/Spam', '[Gmail]/Trash',
# 'aly', 'google', 'test'
# ]
# Sync 'All Mail'/' and handle tags/labels with notmuch;
# also sync 'Spam' and 'Trash' to manage spam and message deletion.
# NOTE: Gmail do NOT allow delete message from 'All Mail';
# however, if a message deleted from 'Spam' or 'Trash', it will be
# deleted permanently.
folderfilter = lambda folder: folder in [
'[Gmail]/All Mail', '[Gmail]/Drafts',
'[Gmail]/Spam', '[Gmail]/Trash',
]
# Translate remote folder names to local folder names
# Do NOT forget the *reverse nametrans* for local repository
nametrans = lambda folder: {
'INBOX' : 'inbox',
'[Gmail]/Sent Mail' : 'sent',
'[Gmail]/All Mail' : 'archive',
'[Gmail]/Starred' : 'flagged',
'[Gmail]/Drafts' : 'drafts',
'[Gmail]/Spam' : 'junk',
'[Gmail]/Trash' : 'trash',
}.get(folder, folder)
## gmail-aly }}}
[Account gmail-li] ## {{{
localrepository = gmail-li-local
remoterepository = gmail-li-remote
status_backend = sqlite
synclabels = yes
labelsheader = X-Keywords
autorefresh = 15
quick = 5
#postsynchook = ~/.offlineimap/postsync.sh
#
[Repository gmail-li-local]
type = GmailMaildir
localfolders = ~/mail/gmail-li
nametrans = lambda folder: {
'inbox' : 'INBOX',
'sent' : '[Gmail]/Sent Mail',
'archive' : '[Gmail]/All Mail',
'flagged' : '[Gmail]/Starred',
'drafts' : '[Gmail]/Drafts',
'junk' : '[Gmail]/Spam',
'trash' : '[Gmail]/Trash',
}.get(folder, folder)
#
[Repository gmail-li-remote]
type = Gmail
remoteuser = liweitianux@gmail.com
remotepasseval = mailpasswd("gmail-li")
auth_mechanisms = GSSAPI, CRAM-MD5, PLAIN, LOGIN
ssl = yes
sslcacertfile = ~/.private/ca-certificates.crt
# Validity: Mar 2 11:00:00 2016 GMT - May 31 00:00:00 2016 GMT
#cert_fingerprint = c1a3bb1a8617af4a28ee2e0cd494533c3cd70bf8
keepalive = 60
holdconnectionopen = yes
folderfilter = lambda folder: folder in [
'[Gmail]/All Mail', '[Gmail]/Drafts',
'[Gmail]/Spam', '[Gmail]/Trash',
]
nametrans = lambda folder: {
'INBOX' : 'inbox',
'[Gmail]/Sent Mail' : 'sent',
'[Gmail]/All Mail' : 'archive',
'[Gmail]/Starred' : 'flagged',
'[Gmail]/Drafts' : 'drafts',
'[Gmail]/Spam' : 'junk',
'[Gmail]/Trash' : 'trash',
}.get(folder, folder)
## gmail-li }}}
[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
nametrans = lambda folder: {
'inbox' : 'Inbox',
'sent' : 'Sent',
'drafts' : 'Drafts',
'archive' : 'Archive',
'junk' : 'Junk',
'trash' : 'Deleted',
}.get(folder, folder)
#
[Repository outlook-aly-remote]
type = IMAP
remotehost = imap-mail.outlook.com
remoteport = 993
remoteuser = aaronly.me@outlook.com
remotepasseval = mailpasswd("outlook-aly")
auth_mechanisms = GSSAPI, CRAM-MD5, PLAIN, LOGIN
ssl = yes
sslcacertfile = ~/.private/ca-certificates.crt
# Validity: Dec 15 22:26:11 2015 GMT - Dec 15 22:26:11 2016 GMT
#cert_fingerprint = c914dd966dbd0912c36ec294f83d8d3b5a434729
keepalive = 60
holdconnectionopen = yes
folderfilter = lambda folder: folder in [
'Inbox', 'Sent', 'Archive',
'Drafts', 'Junk', 'Deleted',
]
nametrans = lambda folder: {
'Inbox' : 'inbox',
'Sent' : 'sent',
'Archive' : 'archive',
'Drafts' : 'drafts',
'Junk' : 'junk',
'Deleted' : 'trash',
}.get(folder, folder)
## outlook-aly }}}
[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
nametrans = lambda folder: {
'inbox' : 'Inbox',
'sent' : 'Sent',
'drafts' : 'Drafts',
'archive' : 'Archive',
'junk' : 'Junk',
'trash' : 'Deleted',
}.get(folder, folder)
#
[Repository outlook-li-remote]
type = IMAP
remotehost = imap-mail.outlook.com
remoteport = 993
remoteuser = liweitianux@live.com
remotepasseval = mailpasswd("outlook-li")
auth_mechanisms = GSSAPI, CRAM-MD5, PLAIN, LOGIN
ssl = yes
sslcacertfile = ~/.private/ca-certificates.crt
# Validity: Dec 15 22:26:11 2015 GMT - Dec 15 22:26:11 2016 GMT
#cert_fingerprint = c914dd966dbd0912c36ec294f83d8d3b5a434729
keepalive = 60
holdconnectionopen = yes
folderfilter = lambda folder: folder in [
'Inbox', 'Sent', 'Archive',
'Drafts', 'Junk', 'Deleted', 'Chats'
]
nametrans = lambda folder: {
'Inbox' : 'inbox',
'Sent' : 'sent',
'Archive' : 'archive',
'Drafts' : 'drafts',
'Junk' : 'junk',
'Deleted' : 'trash',
}.get(folder, folder)
## outlook-li }}}
[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
nametrans = lambda folder: {
'inbox' : 'INBOX',
'sent' : 'Sent',
'drafts' : 'Drafts',
'archive' : 'Archive',
'junk' : 'Junk',
'trash' : 'Trash',
}.get(folder, folder)
#
[Repository sjtu-remote]
type = IMAP
remotehost = imap.sjtu.edu.cn
remoteport = 993
remoteuser = liweitianux@sjtu.edu.cn
remotepasseval = mailpasswd("sjtu")
ssl = yes
sslcacertfile = ~/.private/ca-certificates.crt
# Validity: May 22 00:46:47 2014 GMT - Apr 6 06:54:22 2017 GMT
#cert_fingerprint = b1ec0b44e7aefb983e01dbc3c7432b3aae4910fe
keepalive = 60
holdconnectionopen = yes
folderfilter = lambda folder: folder in [
'INBOX', 'Sent', 'Archive',
'Drafts', 'Junk', 'Trash'
]
nametrans = lambda folder: {
'INBOX' : 'inbox',
'Sent' : 'sent',
'Archive' : 'archive',
'Drafts' : 'drafts',
'Junk' : 'junk',
'Trash' : 'trash',
}.get(folder, folder)
## sjtu }}}
[Account autistici] ## {{{
localrepository = autistici-local
remoterepository = autistici-remote
status_backend = sqlite
autorefresh = 60
quick = 5
#postsynchook = ~/.offlineimap/postsync.sh
#
[Repository autistici-local]
type = Maildir
localfolders = ~/mail/autistici
nametrans = lambda folder: {
'inbox' : 'INBOX',
'sent' : 'Sent',
'drafts' : 'Drafts',
'archive' : 'Archive',
'junk' : 'Spam',
'trash' : 'Trash',
}.get(folder, folder)
#
[Repository autistici-remote]
type = IMAP
remotehost = mail.autistici.org
remoteport = 993
remoteuser = liweitianux@autistici.org
remotepasseval = mailpasswd("autistici")
ssl = yes
sslcacertfile = ~/.private/ca-certificates.crt
# Validity: May 23 09:56:37 2015 GMT - May 22 09:56:37 2017 GMT
#cert_fingerprint = d59db2e0a7a8a0081d3111d3aaf51ccc7a3f20e2
keepalive = 60
holdconnectionopen = yes
folderfilter = lambda folder: folder in [
'INBOX', 'Sent', 'Archive',
'Drafts', 'Spam', 'Trash'
]
nametrans = lambda folder: {
'INBOX' : 'inbox',
'Sent' : 'sent',
'Archive' : 'archive',
'Drafts' : 'drafts',
'Spam' : 'junk',
'Trash' : 'trash',
}.get(folder, folder)
## autistici }}}
[Account foxmail] ## {{{
localrepository = foxmail-local
remoterepository = foxmail-remote
status_backend = sqlite
autorefresh = 60
quick = 5
#postsynchook = ~/.offlineimap/postsync.sh
#
[Repository foxmail-local]
type = Maildir
localfolders = ~/mail/foxmail
nametrans = lambda folder: {
'inbox' : 'INBOX',
'sent' : 'Sent Messages',
'drafts' : 'Drafts',
'archive' : 'Archive',
'junk' : 'Junk',
'trash' : 'Deleted Messages',
}.get(folder, folder)
#
[Repository foxmail-remote]
type = IMAP
remotehost = imap.qq.com
remoteport = 993
remoteuser = liweitianux@foxmail.com
remotepasseval = mailpasswd("foxmail")
ssl = yes
sslcacertfile = ~/.private/ca-certificates.crt
# Validity: Jan 27 00:00:00 2016 GMT - Oct 23 23:59:59 2016 GMT
#cert_fingerprint = 7a845668b97288ad8d265372f6e6e041c73e8d1e
keepalive = 60
holdconnectionopen = yes
folderfilter = lambda folder: folder in [
'INBOX', 'Sent Messages', 'Archive',
'Drafts', 'Junk', 'Deleted Messages'
]
nametrans = lambda folder: {
'INBOX' : 'inbox',
'Sent Messages' : 'sent',
'Archive' : 'archive',
'Drafts' : 'drafts',
'Junk' : 'junk',
'Deleted Messages' : 'trash',
}.get(folder, folder)
## foxmail }}}
# vim: set ts=4 sw=4 tw=0 fenc=utf-8 ft=python: #
|