joeyates / imap-backup

Backup and Migrate IMAP Email Accounts
MIT License
1.33k stars 74 forks source link

Destination folders when Mirroring #202

Closed njakobsen closed 3 weeks ago

njakobsen commented 1 month ago

I have two backups from different sources I'm pushing to a backup IMAP server. I'd like mirror mail from the two sources into separate folders on the remote server.

Here's a picture of what I'm trying to achieve on the backup IMAP server.

Mail from Source A/
  Important
  Updates
  ...
Mail from Source B/
  Inbox
  Sent
  ...

I was hoping the mirror feature would allow me to do this, but it doesn't seem to support specific targeting of a backup into a particular folder. While I see there are namespaces, my understanding is these are more for hinting, and not for arbitrary organization, though perhaps that is what they're for.

@joeyates Before I begin working on such a feature, is this already possible with the current configuration? Does this sound like a feature that would be useful to others?

joeyates commented 1 month ago

Hi @njakobsen

Yes, this should already be possible with the existing parameters using --destination-prefix=PATH. Prefixes exist to handle differences in IMAP server setup, but can be used to add folders to the path.

FYI, I'm about to release a new copy command, which will handle the functionality of the current mirror and migrate - I'm doing this as it confusing to have two separate commands with broadly overlapping function.

Let me know if --destination-prefix=PATH does actually solve your problem!

njakobsen commented 3 weeks ago

I haven't had a chance to try yet, but I'll post my results on this ticket.

njakobsen commented 2 weeks ago

@joeyates it worked as you suggested, though I did run into a few other issues that made the process a little rougher. I've listed them here for posterity.

  1. I have a gmail account that is set to non-mirror mode in order to have a local backup. This is the account I want to mirror to the destination account. It works to back up, but it warns me that the gmail account is not set to mirror mode. It would be less nerve-wracking if the warning told me what would happen as a result of this mismatch, because it's not clear whether emails will be removed or not.
  2. The destination server uses a username not an email address for authentication, but when setting up the account in IMAP-backup I am forced to enter an email address. I was able to work around this by directly modifying the config file to use an account name, but it would be nice if the UI was aware of this dual usage.
  3. Mirroring seems to use the local backup and mirror that to the destination server. In my use case, once that local backup is mirrored onto the destination, I have no use for it and would love to be able to delete it and backup (without mirroring) directly from gmail to the destination server. Since my mail app is IMAP'd to the destination server and is downloading the email anyway, eliminating the need for the local backup would avoid duplicating the amount of email I end up storing on my laptop. At this point I would should probably switch over to the migrate command instead.
  4. I was unable to complete the mirroring because of this error Error in IMAP command UID STORE: Invalid system flag \$NOTJUNK (0.001 + 0.001 secs) which I haven't had a chance to look into yet. It's possibly an incompatibility with the dovecot install Synology's Mail app uses.