barbushin / php-imap

Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP)
MIT License
1.65k stars 459 forks source link

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

Open apohutenumera opened 2 years ago

apohutenumera commented 2 years ago

Environment (please complete the following information):

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

marikv commented 2 years ago

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,

apohutenumera commented 2 years ago

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 ?

blieb commented 1 year ago

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.