php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

[BUG] deleteMail doesn't send email to trash folder

Open apohutenumera opened this issue 3 years ago • 3 comments

Environment (please complete the following information):

  • PHP IMAP version: 3.0.11
  • PHP Version: 7.4
  • Type of execution: Cli

Describe the bug When i use $mailbox->deleteMail($mail_id); mail is removed from INBOX but doesn't appear in Trash folder. Why ?

Expected behavior Mail marked as removed should be moved in trash folder

apohutenumera avatar Apr 25 '22 10:04 apohutenumera

I think it's not a bug if you want to see mails in Trash, you just need to moveMail to Trash deleteMail means completly remove it from server. It's my opinion,

marikv avatar Apr 28 '22 06:04 marikv

OK, it makes sense. I don't find an example for moveMail function (exact forlder syntax). Maybe we should improve deleteMail with a boolean "softDelete" parameter : false by default. If sets to true, move to trash folder. No ?

apohutenumera avatar Apr 28 '22 08:04 apohutenumera

I just do $mailbox->moveMail($mail->id, "Trash"); to move mail to the Trash folder. Be sure to check if the folder that name exists if not create it before moving it.

blieb avatar Jul 27 '22 15:07 blieb