Imapsync: Difference between revisions

From NixOS Wiki
imported>Onny
Add usage example
Klinger (talk | contribs)
mNo edit summary
 
(9 intermediate revisions by 2 users not shown)
Line 14: Line 14:


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# imapsync \
imapsync \
   --host1 mail1.example.org --user1 user1 --password1 "secret1" \
   --host1 mail1.example.org --user1 user1 --password1 "secret1" \
   --host2 mail2.example.org --user2 user1 --password2 "secret1"
   --host2 mail2.example.org --user2 user1 --password2 "secret1" \
  --addheader
</syntaxhighlight>
</syntaxhighlight>


[[Category:Applications]]
Adding parameter <code>--addheader</code> helps if you want to sync draft and sent messages which usually have no headers to be identified.
[[Category:Mail]]
 
=== Filter messages and deletion ===
Additional flags <code>--delete1</code> and <code>--search</code> can be added to sync all messages before the specified date and to remove them after successfull migration to <code>host2</code>
 
<syntaxhighlight lang="console">
imapsync \
  [...]
  --delete1 --delete1emptyfolders \
  --search "SENTBEFORE 01-Jan-2008"
</syntaxhighlight>
 
[[Category:Mail Server]]
[[Category:Server]]

Latest revision as of 19:14, 24 April 2024

Imapsync is a versatile email migration tool that allows users to easily transfer emails between different IMAP email servers. It supports various features such as incremental sync, folder hierarchy preservation, and SSL encryption, making it a reliable choice for seamless email migration.

Installation

To install Imapsync system wide add the following line to your system configuration

/etc/nixos/configuration.nix
environment.systemPackages = [ pkgs.imapsync ];

Usage

Following example transfers all mails from server mail1.example.org to mail2.example.org via IMAP protocol using supplied credentials

imapsync \
  --host1 mail1.example.org --user1 user1 --password1 "secret1" \
  --host2 mail2.example.org --user2 user1 --password2 "secret1" \
  --addheader

Adding parameter --addheader helps if you want to sync draft and sent messages which usually have no headers to be identified.

Filter messages and deletion

Additional flags --delete1 and --search can be added to sync all messages before the specified date and to remove them after successfull migration to host2

imapsync \
  [...]
  --delete1 --delete1emptyfolders \
  --search "SENTBEFORE 01-Jan-2008"