How to move message to Trash folder using IMAP?

1.6k Views Asked by At

Spent hell lot of time to find a proper way to move or delete messages but didn't found any. Every email service acts different. Please help =(

When I try to perform "set delete flag > expunge"...

  • aol.com and outlook.com - email just disappears without being copied to "Trash".
  • gmail.com - email is copied to "All".
  • mail.ru - the only case where it goes to "Trash" after expunge.

I checked on Thunderbird logs and I saw that when user wants to "Delete" a message it just performs default IMAP "Move" operation. I tried to emulate it with "copy > set delete flag > expunge", but result wasn't the same...

  • gmail.com - two copies of deleted email in "All" and "Trash" folders.
  • mail.ru - two copies of deleted email in "Trash" folder.
  • aol.com and outlook.com - haven't checked yet.

Seems like without "Move" all tries to delete or move a message to a different folder are useless...

1

There are 1 best solutions below

0
Nameless One On

Not all IMAP servers will have a Trash folder, since it does not exist in the IMAP RFC. (To find out which folders exist, use the LIST command.) The world has changed a lot since the IMAP RFC was written, and many users expect a kind of Trash folder with restore/undelete capability. So servers and clients bend the RFC a little to emulate that behaviour. I would suggest that you make your behaviour configurable on your client (e.g. with a setting called something like "Move messages to trash when deleted?") This is what a lot of clients do (e.g. K9 mail)