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:
parent
8d6925afd3
commit
5adb799100
@ -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'));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user