php-imap
php-imap copied to clipboard
[BUG] deleteMail doesn't send email to trash folder
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
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,
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 ?
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.