kopia lustrzana https://github.com/newroco/mail2deck
Solve bug when emails were marked for deletion but not added to deck
rodzic
395d9ed512
commit
2ed824c91e
|
@ -10,7 +10,11 @@ use Mail2Deck\ConvertToMD;
|
|||
$inbox = new MailClass();
|
||||
$emails = $inbox->getNewMessages();
|
||||
|
||||
if(!$emails) return; // nothing to do
|
||||
if(!$emails) {
|
||||
// delete all messages marked for deletion and return
|
||||
$inbox->expunge();
|
||||
return;
|
||||
}
|
||||
|
||||
for ($j = 0; $j < count($emails) && $j < 5; $j++) {
|
||||
$structure = $inbox->fetchMessageStructure($emails[$j]);
|
||||
|
|
|
@ -80,15 +80,22 @@ class MailClass {
|
|||
}
|
||||
|
||||
/**
|
||||
* Deletes a mail
|
||||
* Mark emails for deletion
|
||||
*
|
||||
* @param $email email id that you want to delete
|
||||
* @param $email email number that you want to delete
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete(int $email)
|
||||
{
|
||||
imap_delete($this->inbox, $email);
|
||||
imap_delete($this->inbox, imap_uid($this->inbox, $email), FT_UID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all messages marked for deletion
|
||||
*/
|
||||
public function expunge()
|
||||
{
|
||||
imap_expunge($this->inbox);
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue