joeyates / imap-backup

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

No emails download #193

Closed jazoom closed 5 months ago

jazoom commented 5 months ago

I tried with two different servers: iCloud and MXroute. No local files were created for either.

I got lots of these in the logs for both:

I, [2024-01-21T00:39:10.822371 #1]  INFO -- : [INBOX] 60 new messages
I, [2024-01-21T00:39:41.965524 #1]  INFO -- : Metadata file '/app/<username>_icloud.com/Drafts.imap' is invalid
I, [2024-01-21T00:39:41.965557 #1]  INFO -- : Mailbox '/app/<username>_icloud.com/Drafts.mbox' is invalid
I, [2024-01-21T00:39:41.965632 #1]  INFO -- : Metadata file '/app/<username>_icloud.com/Drafts.imap' is invalid
I, [2024-01-21T00:39:41.965652 #1]  INFO -- : Mailbox '/app/<username>_icloud.com/Drafts.mbox' is invalid

It was the same for every folder on the server.

Any idea what's going on here? A bug or have I done something wrong?

This is how I ran it:

SERVICE_NAME="iCloud" && \
IMAP_SERVER="imap.mail.me.com" && \
IMAP_EMAIL="<username>@icloud.com" && \
IMAP_PASSWORD="password" && \
EMAIL_BACKUP_DIR="/path/email-backups/$(date +%Y-%m-%d)-$SERVICE_NAME" && \
mkdir -p $EMAIL_BACKUP_DIR && \
podman run --rm -v $EMAIL_BACKUP_DIR:/data ghcr.io/joeyates/imap-backup:latest imap-backup single backup --server $IMAP_SERVER --email $IMAP_EMAIL --password $IMAP_PASSWORD
joeyates commented 5 months ago

Hi @jazoom

Thanks for opening the issue.

I'm glad to see someone's using the container image :smiley:

As you are not specifying the --path parameter, imap-backup is using the default, which is the current directory + the email.

In the container, the current directory is /app, so I think the backup is being saved in /app/<username>_icloud.com.

So, if you specify --path /data, you may have more luck!

jazoom commented 5 months ago

Thanks for the reply @joeyates. Indeed I did have more luck specifying that path.

However, I still get "... is invalid" for every single directory. What is the meaning of this? It seems to work.

...except, emails within subfolders in iCloud weren't backed up.

joeyates commented 5 months ago

Hi @jazoom

The "... is invalid" messages are distracting noise - they're getting printed when the files are missing. Needs to be corrected so that the message is only shown when the files are present and malformed.

joeyates commented 5 months ago

I've published version 14.5.2, which no longer prints "... is invalid" messages when the files are missing.

joeyates commented 5 months ago

@jazoom, you say "emails within subfolders in iCloud weren't backed up."

Two things:

  1. Could you check file permissions on $EMAIL_BACKUP_DIR?
  2. Turn on verbose logging with -v and see if you have output for the subfolders.
jazoom commented 5 months ago

...they're getting printed when the files are missing

I'm curious, what does "missing" mean? Are they expected to be there? Their absence doesn't seem to affect backups. I'm trying to understand their significance while I debug this.

The path suggests to me it's looking locally rather than in the mail server. Was it looking for existing backups to sync to and didn't find them? As in, they don't exist yet, rather than missing? If this is the case then I totally agree with silencing this message.

jazoom commented 5 months ago

After investigating further it appears subfolders are backed up. It seems to actually be a bug in Thunderbird where it doesn't show any emails in subfolders.

jazoom commented 5 months ago

@joeyates thanks for providing this great software and for helping me to get it working. This is truly a painless way to backup emails.