forked from konvpalto/offlineimaporg
-
Notifications
You must be signed in to change notification settings - Fork 2
/
examples.html
163 lines (151 loc) · 6.13 KB
/
examples.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>OfflineIMAP home</title>
<!--[if lt IE 9]>
// teach older IEs to render those elements at all (http://diveintohtml5.org/semantics.html#unknown-elements)
<script>
var e = ("abbr,article,aside,audio,canvas,datalist,details," +
"figure,footer,header,hgroup,mark,menu,meter,nav,output," +
"progress,section,time,video").split(',');
for (var i = 0; i < e.length; i++) {
document.createElement(e[i]);
}
</script>
<![endif]-->
<link href='http://fonts.googleapis.com/css?family=Walter+Turncoat' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<header>
<img id="logo" src="img/logo.png">
<hgroup>
<h1><a href="http://offlineimap.org">OfflineImap</a></h1>
<h2>Syncing IMAP accounts since 2002</h2>
</hgroup>
<nav>
<a class="reference" href="index.html">Home</a>
<a class="reference" href="index.html#ref-download" >Download</a>
<a class="reference" href="index.html#ref-quick-start" >Quick Start</a>
<a class="reference" href="index.html#ref-documentation" >Documentation</a>
<a class="reference" href="development.html" >Development</a>
<a class="reference" href="index.html#ref-links">Links</a>
</nav>
</header>
<section id="content">
<header><h1><a id="ref-examples" ></a>Examples</h1></header>
<p>Here are some example configurations for various situations. Please e-mail any
other examples you have that may be useful to me.</p>
<article>
<h2><a class="toc-backref" href="#id11" id="multiple-accounts-with-mutt" name="multiple-accounts-with-mutt">2.1 Multiple Accounts with Mutt</a></h2>
<p>This example shows you how to set up OfflineIMAP to synchronize multiple
accounts with the mutt mail reader.</p>
<p>Start by creating a directory to hold your folders by running <tt class="docutils literal"><span class="pre">mkdir</span> <span class="pre">~/Mail</span></tt>.
Then, in your <tt class="docutils literal"><span class="pre">~/.offlineimaprc</span></tt>, specify:</p>
<pre class="literal-block">
accounts = Personal, Work
</pre>
<p>Make sure that you have both an [Account Personal] and an [Account Work]
section. The local repository for each account must have different localfolder
path names. Also, make sure to enable [mbnames].</p>
<p>In each local repository section, write something like this:</p>
<pre class="literal-block">
localfolders = ~/Mail/Personal
</pre>
<p>Finally, add these lines to your <tt class="docutils literal"><span class="pre">~/.muttrc</span></tt>:</p>
<pre class="literal-block">
source ~/path-to-mbnames-muttrc-mailboxes
folder-hook Personal set from="youremail@personal.com"
folder-hook Work set from="youremail@work.com"
set mbox_type=Maildir
set folder=$HOME/Mail
spoolfile=+Personal/INBOX
</pre>
<p>That's it!</p>
</article>
<article>
<h2><a class="toc-backref" href="#id12" id="uw-imapd-and-references" name="uw-imapd-and-references">2.2 UW-IMAPD and References</a></h2>
<p>Some users with a UW-IMAPD server need to use OfflineIMAP's "reference" feature
to get at their mailboxes, specifying a reference of <tt class="docutils literal"><span class="pre">~/Mail</span></tt> or <tt class="docutils literal"><span class="pre">#mh/</span></tt>
depending on the configuration. The below configuration from (originally from
<a class="reference" href="mailto:docwhat@gerf.org">docwhat@gerf.org</a>) shows using a reference of Mail, a nametrans that strips the
leading Mail/ off incoming folder names, and a folderfilter that limits the
folders synced to just three:</p>
<pre class="literal-block">
[Account Gerf]
localrepository = GerfLocal
remoterepository = GerfRemote
[Repository GerfLocal]
type = Maildir
localfolders = ~/Mail
[Repository GerfRemote]
type = IMAP
remotehost = gerf.org
ssl = yes
remoteuser = docwhat
reference = Mail
# Trims off the preceeding Mail on all the folder names.
nametrans = lambda foldername: \
re.sub('^Mail/', '', foldername)
# Yeah, you have to mention the Mail dir, even though it
# would seem intuitive that reference would trim it.
folderfilter = lambda foldername: foldername in [
'Mail/INBOX',
'Mail/list/zaurus-general',
'Mail/list/zaurus-dev',
]
maxconnections = 1
holdconnectionopen = no
</pre>
</article>
<article>
<h2><a class="toc-backref" href="#id13" id="pythonfile-configuration-file-option" name="pythonfile-configuration-file-option">2.3 pythonfile Configuration File Option</a></h2>
<p>You can have OfflineIMAP load up a Python file before evaluating the
configuration file options that are Python expressions. This example is based
on one supplied by Tommi Virtanen for this feature.</p>
<p>In ~/.offlineimaprc, he adds these options:</p>
<pre class="literal-block">
[general]
pythonfile=~/.offlineimap.py
[Repository foo]
foldersort=mycmp
</pre>
<p>Then, the ~/.offlineimap.py file will contain:</p>
<pre class="literal-block">
prioritized = ['INBOX', 'personal', 'announce', 'list']
def mycmp(x, y):
for prefix in prioritized:
xsw = x.startswith(prefix)
ysw = y.startswith(prefix)
if xsw and ysw:
return cmp(x, y)
elif xsw:
return -1
elif ysw:
return +1
return cmp(x, y)
def test_mycmp():
import os, os.path
folders=os.listdir(os.path.expanduser('~/data/mail/tv@hq.yok.utu.fi'))
folders.sort(mycmp)
print folders
</pre>
<p>This code snippet illustrates how the foldersort option can be customized with a
Python function from the pythonfile to always synchronize certain folders first.</p>
</article>
<article>
<h2><a class="toc-backref" href="#id14" id="signals" name="signals">2.4 Signals</a></h2>
<p>OfflineIMAP writes its current PID into <tt class="docutils literal"><span class="pre">~/.offlineimap/pid</span></tt> when it is
running. It is not guaranteed that this file will not exist when OfflineIMAP is
not running.</p>
<p><!-- not done yet</p>
<blockquote>
You can send SIGINT to OfflineIMAP using this file to kill it. SIGUSR1 will
force an immediate resync of all accounts. This will be ignored for all
accounts for which a resync is already in progress.</blockquote>
<p>--></p>
</article>
</section>
</body>
</html>