offlineimap.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. offlineimap(1)
  2. ==============
  3. NAME
  4. ----
  5. offlineimap - Synchronize mailboxes and Maildirs
  6. SYNOPSIS
  7. --------
  8. [verse]
  9. 'offlineimap' (options)
  10. DESCRIPTION
  11. -----------
  12. Synchronize the accounts configured in the configuration file via IMAP. Each
  13. account has two sides. One of the side must be an IMAP server. The other side
  14. can either be a Maildir or another IMAP server.
  15. Python 3 is supported while still EXPERIMENTAL.
  16. OPTIONS
  17. -------
  18. -h::
  19. --help::
  20. Display summary of options.
  21. --version::
  22. Output version.
  23. -V::
  24. Output offlineimap version and additional imaplib2 information.
  25. --dry-run::
  26. Run in dry run mode.
  27. +
  28. Do not actually modify any store but check and print what synchronization
  29. actions would be taken if a sync would be performed. It will not precisely
  30. give the exact information what will happen. If e.g. we need to create a
  31. folder, it merely outputs 'Would create folder X', but not how many and which
  32. mails it would transfer.
  33. --info::
  34. Output information on the configured email repositories.
  35. +
  36. Useful for debugging and bug reporting. Use in conjunction with the `-a' option
  37. to limit the output to a single account. This mode will prevent any actual sync
  38. to occur and exits after it output the debug information.
  39. -1::
  40. Limit multithreading operations and run solely a single-thread sync.
  41. +
  42. This effectively sets the 'maxsyncaccounts' and all 'maxconnections' configuration
  43. file variables to '1' (the number).
  44. -P <directory>::
  45. Set OfflineIMAP into profile mode.
  46. +
  47. The program will create DIR (it must not already exist). As it runs, Python
  48. profiling information about each thread is logged into profiledir. Please
  49. note: This option is present for debugging and optimization only, and should
  50. NOT be used unless you have a specific reason to do so. It will significantly
  51. decrease program performance, may reduce reliability, and can generate huge
  52. amounts of data. This option implies the `-1' option.
  53. -a <account1[,account2[,...]]>::
  54. Overrides the accounts section in the config file.
  55. +
  56. Allows one to specify a particular account or set of accounts to sync without
  57. having to edit the config file.
  58. -c <path/to/configuration_file>::
  59. Specifies a configuration file to use.
  60. -d <type1[,type2[,...]]>::
  61. Enables debugging for OfflineIMAP.
  62. +
  63. This is useful if you are to track down a malfunction or figure out what is
  64. going on under the hood. This option requires one or more debugtypes,
  65. separated by commas. These define what exactly will be debugged, and so far
  66. include options: "imap", "thread", "maildir" or "ALL". The imap option will enable
  67. IMAP protocol stream and parsing debugging. Note that the output may contain
  68. passwords, so take care to remove that from the debugging output before
  69. sending it to anyone else. The maildir option will enable debugging for
  70. certain Maildir operations. The use of any debug option (unless "thread" is
  71. included), implies the single-thread option `-1'.
  72. -l <path/to/file.log>::
  73. Send logs to <file.log>.
  74. -s::
  75. Send logs to syslog.
  76. -f <folder1[,folder1[,...]]>::
  77. Only sync the specified folders.
  78. +
  79. The folder names are the untranslated foldernames of the remote repository.
  80. This command-line option overrides any 'folderfilter' and 'folderincludes'
  81. options in the configuration file.
  82. -k <[section:]option=value::
  83. Override any configuration file option.
  84. +
  85. If "section" is omitted, it defaults to "general". Any underscores in the
  86. section name are replaced with spaces: for instance, to override option
  87. "autorefresh" in the "[Account Personal]" section in the config file one would
  88. use `-k Account_Personal:autorefresh=30'. Repeat this option as much as
  89. necessary to redefine multiple options.
  90. -o::
  91. Run only once.
  92. +
  93. Ignore any autorefresh setting in the configuration file.
  94. -q::
  95. Run only quick synchronizations.
  96. +
  97. Ignore any flag updates on IMAP servers. If a flag on the remote IMAP changes,
  98. and we have the message locally, it will be left untouched in a quick run. This
  99. option is ignored if maxage is set.
  100. -u <UI>::
  101. Specifies an alternative user interface to use.
  102. +
  103. This overrides the default specified in the configuration file. The UI
  104. specified with `-u' will be forced to be used, even if checks determine that it
  105. is not usable. Possible interface choices are: quiet, basic, syslog, ttyui,
  106. blinkenlights, machineui.
  107. --delete-folder::
  108. Delete a folder on the remote repository.
  109. +
  110. Only one account must be specified/configured for this feature to work. The
  111. folder name must be provided in IMAP encoding with the remote separators (likely
  112. '/'). E.g.: "Remote/folder/name".
  113. --migrate-fmd5-using-nametrans::
  114. Migrate FMD5 hashes from versions prior to 6.3.5.
  115. +
  116. The way that FMD5 hashes are calculated was changed in version 6.3.5 (now using
  117. the nametrans folder name) introducing a regression which may lead to
  118. re-uploading all messages. Try and fix the above regression by calculating the
  119. correct FMD5 values and renaming the corresponding messages.
  120. CAUTION: Since the FMD5 part of the filename changes, this may lead to UID
  121. conflicts. Ensure to dispose a proper backup of both the cache and the Maildir
  122. before running this fix as well as verify the results using the `--dry-run'
  123. flag first.
  124. --mbnames-prune::
  125. Remove dangling entries for removed accounts or if mbnames is not enabled/used
  126. anymore.
  127. +
  128. Internally, offlineimap build intermediate mbnames files. They are added
  129. automatically when mbnames is enabled. However, disabling accounts so they are
  130. not synced anymore does not necessarily means they should be removed from the file
  131. built by mbnames. It is required to start offlineimap with this CLI option each
  132. time accounts are removed. When run, any account not in the 'accounts'
  133. configuration option are removed in the mbnames file.
  134. +
  135. It is possible to manually remove intermediate files in '<metadata>/mbnames/'.
  136. +
  137. Notice this option honors --dry-run.
  138. Synchronization Performance
  139. ---------------------------
  140. By default, we use fairly conservative settings that are safe for syncing but
  141. that might not be the best performing one. Once you got everything set up and
  142. running, you might want to look into speeding up your synchronization. Here
  143. are a couple of hints and tips on how to achieve this.
  144. 1. Synchronize more than one account.
  145. +
  146. By default we only use one connection to an IMAP server. Using 2 or even 3
  147. speeds things up considerably in most cases. In order to synchronize more than
  148. one account concurrently, consider starting one instance of offlineimap per
  149. account.
  150. +
  151. WARNING: enabling the 'maxsyncaccounts' and 'maxconnections' options is
  152. deprecated since it's known to have race conditions.
  153. 2. Use folderfilters.
  154. +
  155. The quickest sync is a sync that can ignore some folders. I sort my inbox into
  156. monthly folders, and ignore every folder that is more than 2-3 months old,
  157. this lets me only inspect a fraction of my Mails on every sync. If you haven't
  158. done this yet, do it :). See the 'folderfilter' section in 'offlineimap.conf'.
  159. 3. The sqlite cache.
  160. +
  161. OfflineImap caches the state of the synchronisation to e.g. be able to determine
  162. if a mail has been added or deleted on either side.
  163. +
  164. The historical status cache is a plain text file that writes out the complete
  165. file for each single new message (or even changed flag) to a temporary file. If
  166. you have plenty of files in a folder, this is a few hundred kilo to megabytes
  167. for each mail and is bound to make things slow. The latest default status cache
  168. is sqlite. This saves plenty of disk activity. The sqlite engine and the Python
  169. sqlite module must be installed. Enable the 'status_backend = plain' setting in
  170. 'offlineimap.conf' for legacy compatibility with versions prior to '6.4.0'.
  171. +
  172. If you switch the backend from plain to sqlite, you may want to delete the old
  173. cache directory in '<metadata>/Account-<account>/LocalStatus' manually (the
  174. sqlite cache stands in the 'LocalStatus-sqlite' folder).
  175. 4. Use quick sync.
  176. +
  177. A regular sync will request all flags and all UIDs of all mails in each folder
  178. which takes quite some time. A quick sync only compares the number of
  179. messages in a folder on the IMAP side (it will detect flag changes on the
  180. Maildir side of things though). A quick sync on my smallish account will take
  181. 7 seconds rather than 40 seconds. E.g. run a cron script that does a regular
  182. sync once a day, and does quick syncs `-q' only synchronizing the `-f INBOX'
  183. in between.
  184. 5. Turn off fsync.
  185. +
  186. In the '[general]' section you can set fsync to 'True' or 'False'. If you want to
  187. play 110% safe and wait for all operations to hit the disk before continuing,
  188. you can set this to True. If you set it to False, you lose some of that
  189. safety, trading it for speed.
  190. Security and SSL
  191. ----------------
  192. By default, OfflineIMAP will connect using any method that 'openssl' supports,
  193. that is SSLv2, SSLv3, or TLSv1.
  194. Do note that SSLv2 is notoriously insecure and deprecated. Unfortunately,
  195. python2 does not offer easy ways to disable SSLv2. It is recommended you test
  196. your setup and make sure that the mail server does not use an SSLv2
  197. connection. Use e.g. "openssl s_client -host mail.server -port 443" to find
  198. out the connection that is used by default.
  199. * Certificate checking
  200. +
  201. Unfortunately, by default we will not verify the certificate of an IMAP
  202. TLS/SSL server we connect to, so connecting by SSL is no guarantee against
  203. man-in-the-middle attacks. While verifying a server certificate checking the
  204. fingerprint is recommended. There is currently only one safe way
  205. to ensure that you connect to the correct server in an encrypted manner: you
  206. can specify a 'sslcacertfile' setting in your repository section of
  207. offlineimap.conf pointing to a file that contains (among others) a CA
  208. Certificate in PEM format which validating your server certificate. In this
  209. case, we will check that:
  210. 1. The server SSL certificate is validated by the CA Certificate.
  211. 2. The server host name matches the SSL certificate.
  212. 3. The server certificate is not past its expiration date.
  213. The FAQ has an entry on how to create your own certificate and CA certificate.
  214. * StartTLS
  215. +
  216. If you have not configured your account to connect via SSL anyway, OfflineImap
  217. will still attempt to set up an SSL connection via the STARTTLS function, in
  218. case the imap server supports it.
  219. +
  220. There is no certificate or fingerprint checking involved at all, when using
  221. STARTTLS (the underlying imaplib library does not support this yet). This
  222. means that you will be protected against passively listening eavesdroppers and
  223. they will not be able to see your password or email contents. However, this
  224. will not protect you from active attacks, such as Man-In-The-Middle attacks
  225. which cause you to connect to the wrong server and pretend to be your mail
  226. server.
  227. +
  228. *DO NOT RELY ON STARTTLS AS A SAFE CONNECTION GUARANTEEING THE AUTHENTICITY OF
  229. YOUR IMAP SERVER!*
  230. Unix Signals
  231. ------------
  232. OfflineImap listens to the unix signals SIGUSR1, SIGUSR2, SIGTERM, SIGINT,
  233. SIGHUP, SIGQUIT.
  234. * If sent a SIGUSR1 it will abort any current (or next future) sleep of all
  235. accounts that are configured to 'autorefresh'. In effect, this will trigger a
  236. full sync of all accounts to be performed as soon as possible.
  237. * If sent a SIGUSR2 or SIGABRT, it will stop 'autorefresh' mode for all
  238. accounts. That is, accounts will abort any current sleep and will exit after a
  239. currently running synchronization has finished. This signal can be used to
  240. gracefully exit out of a running offlineimap "daemon".
  241. * SIGTERM, SIGINT, SIGHUP are all treated to gracefully terminate as soon as
  242. possible. This means it will finish syncing the current folder in each
  243. account, close keep alive connections, remove locks on the accounts and exit.
  244. +
  245. It may take up to 10 seconds, if autorefresh option is used.
  246. +
  247. More than one SIGTERM will behave like SIGQUIT.
  248. * If sent SIGQUIT, dumps stack traces for all threads and tries to dump
  249. process core.
  250. Known Issues
  251. ------------
  252. include::./offlineimap.known_issues.txt[]
  253. Main authors
  254. ------------
  255. John Goerzen, Sebastian Spaetz, Eygene Ryabinkin, Nicolas Sebrecht.
  256. See Also
  257. --------
  258. offlineimapui(7), openssl(1), signal(7), sqlite3(1).
  259. http://www.offlineimap.org