Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Jingga
4 *
5 * PHP Version 8.1
6 *
7 * @package   phpOMS\Message\Mail
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15namespace phpOMS\Message\Mail;
16
17/**
18 * Message interface.
19 *
20 * @package phpOMS\Message\Mail
21 * @license OMS License 2.0
22 * @link    https://jingga.app
23 * @since   1.0.0
24 */
25interface MailBoxInterface
26{
27    /**
28     * Connect to server
29     *
30     * @return bool
31     *
32     * @since 1.0.0
33     */
34    public function connectInbox() : bool;
35
36    /**
37     * Close mailbox
38     *
39     * @return void
40     *
41     * @since 1.0.0
42     */
43    public function closeInbox() : void;
44
45    /**
46     * Count mail in mailbox
47     *
48     * @param string $box Box to count the mail in
49     *
50     * @return int
51     *
52     * @since 1.0.0
53     */
54    public function countMail(string $box) : int;
55
56    /**
57     * Count recent mail in mailbox
58     *
59     * @param string $box Box to count the mail in
60     *
61     * @return int
62     *
63     * @since 1.0.0
64     */
65    public function countRecent(string $box) : int;
66
67    /**
68     * Count unseen mail in mailbox
69     *
70     * @param string $box Box to count the mail in
71     *
72     * @return int
73     *
74     * @since 1.0.0
75     */
76    public function countUnseen(string $box) : int;
77
78    /**
79     * Get messages by search criterium
80     *
81     * @param string    $box     Box to count the mail in
82     * @param string    $subject Subject
83     * @param string    $body    Body
84     * @param string    $to      To
85     * @param string    $cc      CC
86     * @param string    $from    From
87     * @param string    $bcc     BCC
88     * @param \DateTime $before  Message before
89     * @param \DateTime $sicne   Message since
90     * @param \DateTime $on      Message on date
91     * @param bool      $deleted Message is deleted
92     * @param bool      $flagged Message is flagged (false = any message)
93     *
94     * @return array
95     *
96     * @since 1.0.0
97     */
98    public function search(
99        string $box,
100        string $subject = '',
101        string $body = '',
102        string $to = '',
103        string $cc = '',
104        string $from = '',
105        string $bcc = '',
106        \DateTime $before = null,
107        \DateTime $since = null,
108        \DateTime $on = null,
109        bool $deleted = false,
110        bool $flagged = false
111    ) : array;
112
113    /**
114     * Get all message headers from a mailbox
115     *
116     * @param string $box Mailbox
117     *
118     * @return array
119     *
120     * @since 1.0.0
121     */
122    public function getHeaders(string $box) : array;
123
124    /**
125     * Get mailbox information summary
126     *
127     * @param string $box Box to check
128     *
129     * @return object
130     *
131     * @since 1.0.0
132     */
133    public function getMailboxInfo(string $box) : object;
134
135    /**
136     * Get message
137     *
138     * @param int $msg Message number (not uid)
139     *
140     * @return Email
141     *
142     * @since 1.0.0
143     */
144    public function getMail(int $msg) : Email;
145}