1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 23:22:52 +01:00

removing pop3 integration, becasue we cannot move mails

This commit is contained in:
paulwer 2023-12-14 18:25:38 +01:00
parent 8d6925afd3
commit 5adb799100

View File

@ -1,57 +0,0 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Helpers\Mail;
use Ddeboer\Imap\MessageInterface;
use Ddeboer\Imap\Server;
use Ddeboer\Imap\SearchExpression;
use Ddeboer\Imap\Search\Date\Since;
/**
* TODO
*/
class Pop3Mailbox implements BaseMailbox
{
private $server;
public $connection;
public function __construct(string $server, string $port, string $user, string $password)
{
$this->server = new Server($server, $port != '' ? $port : null);
$this->connection = $this->server->authenticate($user, $password);
}
public function getUnprocessedEmails()
{
$mailbox = $this->connection->getMailbox('INBOX');
$search = new SearchExpression();
// not older than 30days
$today = new \DateTimeImmutable();
$thirtyDaysAgo = $today->sub(new \DateInterval('P30D'));
$search->addCondition(new Since($thirtyDaysAgo));
return $mailbox->getMessages($search);
}
public function moveProcessed(MessageInterface $mail)
{
return $mail->move($this->connection->getMailbox('PROCESSED'));
}
public function moveFailed(MessageInterface $mail)
{
return $mail->move($this->connection->getMailbox('FAILED'));
}
}