offlineimap.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. offlineimap(1)
  2. ==============
  3. NAME
  4. ----
  5. offlineimap - Synchronize mailboxes and Maildirs both ways or one either way.
  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. Works with Python 2.
  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 or you
  111. must provide one account with -a. The folder name must be provided with the
  112. remote separators (likely '/') in UTF-8 if utf8foldernames is enabled or in IMAP
  113. otherwise. E.g.: "Remote/folder/name".
  114. --migrate-fmd5-using-nametrans::
  115. Migrate FMD5 hashes from versions prior to 6.3.5.
  116. +
  117. The way that FMD5 hashes are calculated was changed in version 6.3.5 (now using
  118. the nametrans folder name) introducing a regression which may lead to
  119. re-uploading all messages. Try and fix the above regression by calculating the
  120. correct FMD5 values and renaming the corresponding messages.
  121. CAUTION: Since the FMD5 part of the filename changes, this may lead to UID
  122. conflicts. Ensure to dispose a proper backup of both the cache and the Maildir
  123. before running this fix as well as verify the results using the `--dry-run'
  124. flag first.
  125. --mbnames-prune::
  126. Remove dangling entries for removed accounts or if mbnames is not enabled/used
  127. anymore.
  128. +
  129. Internally, offlineimap build intermediate mbnames files. They are added
  130. automatically when mbnames is enabled. However, disabling accounts so they are
  131. not synced anymore does not necessarily means they should be removed from the file
  132. built by mbnames. It is required to start offlineimap with this CLI option each
  133. time accounts are removed. When run, any account not in the 'accounts'
  134. configuration option are removed in the mbnames file.
  135. +
  136. It is possible to manually remove intermediate files in '<metadata>/mbnames/'.
  137. +
  138. Notice this option honors --dry-run.
  139. Synchronization Performance
  140. ---------------------------
  141. By default, we use fairly conservative settings that are safe for syncing but
  142. that might not be the best performing one. Once you got everything set up and
  143. running, you might want to look into speeding up your synchronization. Here
  144. are a couple of hints and tips on how to achieve this.
  145. 1. Synchronize more than one account.
  146. +
  147. By default we only use one connection to an IMAP server. Using 2 or even 3
  148. speeds things up considerably in most cases. In order to synchronize more than
  149. one account concurrently, consider starting one instance of offlineimap per
  150. account.
  151. +
  152. WARNING: enabling the 'maxsyncaccounts' and 'maxconnections' options is
  153. deprecated since it's known to have race conditions.
  154. 2. Use folderfilters.
  155. +
  156. The quickest sync is a sync that can ignore some folders. I sort my inbox into
  157. monthly folders, and ignore every folder that is more than 2-3 months old,
  158. this lets me only inspect a fraction of my Mails on every sync. If you haven't
  159. done this yet, do it :). See the 'folderfilter' section in 'offlineimap.conf'.
  160. 3. The sqlite cache.
  161. +
  162. OfflineImap caches the state of the synchronisation to e.g. be able to determine
  163. if a mail has been added or deleted on either side.
  164. +
  165. The historical status cache was a plain text file that was writing out the
  166. complete file for each single new message (or even changed flag) to a temporary
  167. file. If there was plenty of files in a folder this was bound to make things
  168. slow. The latest status cache is sqlite. This saves plenty of disk activity.
  169. +
  170. The historical plain status cache is not supported anymore but migrating from a
  171. very old installation using the plain text cache is still supported. In this
  172. case, you may want to delete the old cache directory in
  173. '<metadata>/Account-<account>/LocalStatus' manually (the sqlite cache stands in
  174. the 'LocalStatus-sqlite' folder). First, make sure you have run the new version
  175. of offlineimap for all your accounts so that the status cache was migrated.
  176. 4. Use quick sync.
  177. +
  178. A regular sync will request all flags and all UIDs of all mails in each folder
  179. which takes quite some time. A quick sync only compares the number of
  180. messages in a folder on the IMAP side (it will detect flag changes on the
  181. Maildir side of things though). A quick sync on my smallish account will take
  182. 7 seconds rather than 40 seconds. E.g. run a cron script that does a regular
  183. sync once a day, and does quick syncs `-q' only synchronizing the `-f INBOX'
  184. in between.
  185. 5. Turn off fsync.
  186. +
  187. In the '[general]' section you can set fsync to 'True' or 'False'. If you want to
  188. play 110% safe and wait for all operations to hit the disk before continuing,
  189. you can set this to True. If you set it to False, you lose some of that
  190. safety, trading it for speed.
  191. Security and SSL
  192. ----------------
  193. By default, OfflineIMAP will connect using any method that 'openssl' supports,
  194. that is SSLv2, SSLv3, or TLSv1.
  195. Do note that SSLv2 is notoriously insecure and deprecated. Unfortunately,
  196. python2 does not offer easy ways to disable SSLv2. It is recommended you test
  197. your setup and make sure that the mail server does not use an SSLv2
  198. connection. Use e.g. "openssl s_client -host mail.server -port 443" to find
  199. out the connection that is used by default.
  200. * Certificate checking
  201. +
  202. Unfortunately, by default we will not verify the certificate of an IMAP
  203. TLS/SSL server we connect to, so connecting by SSL is no guarantee against
  204. man-in-the-middle attacks. While verifying a server certificate checking the
  205. fingerprint is recommended. There is currently only one safe way
  206. to ensure that you connect to the correct server in an encrypted manner: you
  207. can specify a 'sslcacertfile' setting in your repository section of
  208. offlineimap.conf pointing to a file that contains (among others) a CA
  209. Certificate in PEM format which validating your server certificate. In this
  210. case, we will check that:
  211. 1. The server SSL certificate is validated by the CA Certificate.
  212. 2. The server host name matches the SSL certificate.
  213. 3. The server certificate is not past its expiration date.
  214. The FAQ has an entry on how to create your own certificate and CA certificate.
  215. * StartTLS
  216. +
  217. If you have not configured your account to connect via SSL anyway, OfflineImap
  218. will still attempt to set up an SSL connection via the STARTTLS function, in
  219. case the imap server supports it.
  220. +
  221. There is no certificate or fingerprint checking involved at all, when using
  222. STARTTLS (the underlying imaplib library does not support this yet). This
  223. means that you will be protected against passively listening eavesdroppers and
  224. they will not be able to see your password or email contents. However, this
  225. will not protect you from active attacks, such as Man-In-The-Middle attacks
  226. which cause you to connect to the wrong server and pretend to be your mail
  227. server.
  228. +
  229. *DO NOT RELY ON STARTTLS AS A SAFE CONNECTION GUARANTEEING THE AUTHENTICITY OF
  230. YOUR IMAP SERVER!*
  231. Unix Signals
  232. ------------
  233. OfflineImap listens to the unix signals SIGUSR1, SIGUSR2, SIGTERM, SIGINT,
  234. SIGHUP, SIGQUIT.
  235. * If sent a SIGUSR1 it will abort any current (or next future) sleep of all
  236. accounts that are configured to 'autorefresh'. In effect, this will trigger a
  237. full sync of all accounts to be performed as soon as possible.
  238. * If sent a SIGUSR2 or SIGABRT, it will stop 'autorefresh' mode for all
  239. accounts. That is, accounts will abort any current sleep and will exit after a
  240. currently running synchronization has finished. This signal can be used to
  241. gracefully exit out of a running offlineimap "daemon".
  242. * SIGTERM, SIGINT, SIGHUP are all treated to gracefully terminate as soon as
  243. possible. This means it will finish syncing the current folder in each
  244. account, close keep alive connections, remove locks on the accounts and exit.
  245. +
  246. It may take up to 10 seconds, if autorefresh option is used.
  247. +
  248. More than one SIGTERM will behave like SIGQUIT.
  249. * If sent SIGQUIT, dumps stack traces for all threads and tries to dump
  250. process core.
  251. Known Issues
  252. ------------
  253. include::./offlineimap.known_issues.txt[]
  254. Main authors
  255. ------------
  256. John Goerzen, Sebastian Spaetz, Eygene Ryabinkin, Nicolas Sebrecht.
  257. See Also
  258. --------
  259. offlineimapui(7), openssl(1), signal(7), sqlite3(1).
  260. http://www.offlineimap.org