pimalaya/himalaya

use builtin IMAP functions for copying and moving emails

Closed this issue · 9 comments

Lost some emails by doing this lol:

> himalaya  move 1 archive
Error: cannot append message to mailbox archive

Caused by:
    Could not append mail to mailbox

archive is an alias to "Archive".

  1. Himalaya should be able to handle folder aliases here imo, because my gmail folders are super ugly...
  2. Himalaya should probably validate the destination folder before moving the email into nirvana lmao

the destination being an alias doesn't matter. the same thing happens when the folder plainly doesn't exist.

Lost some emails by doing this lol:

Hence the warning on the README The project is under active development. Do not use in production before the v1.0.0. 🤣

archive is an alias to "Archive".

How did you set up your alias? Could you share your configuration?

Himalaya should probably validate the destination folder before moving the email into nirvana lmao

This for sure, in fact the email should be append first then removed, I guess it is better to have two copies than none 😅

Which version do you use?

No worries, nothing of value was lost! Not on my desk right now, but basically:

[ACCOUNT]
folder-alias.archive = "my-ugly-gmail-folder"

this actually works when listing email from the folder. I used the current version in the arch repository.

I can rebuild from master to see if it helps.

I just realize that I did the copy and the move manually (delete then append), whereas there is a copy and a mv function available in the imap crate 🤦 either they are new commands or I did not see them when I developed this part… I will change this ASAP!

Plus the mv command is safe, which prevents losses:

Because a MOVE applies to a set of messages, it might fail partway through the set.
Regardless of whether the command is successful in moving the entire set, each individual
message will either be moved or unaffected. The server will leave each message in a state
where it is in at least one of the source or target mailboxes (no message can be lost or
orphaned). The server will generally not leave any message in both mailboxes (it would be
bad for a partial failure to result in a bunch of duplicate messages). This is true even
if the server returns with [Error::No].

I also realized that aliases are not resolved for some reason, you just found two horrible bugs in one 🤣 thank you for pointed this out 👍

Hehe glad I could be of help! Loving himalaya. Finally got an email workflow I am happy with!

Fixed by cb87728, it should available in the next release!