-
-
Notifications
You must be signed in to change notification settings - Fork 165
/
Copy pathIMAP.php
375 lines (339 loc) · 9.66 KB
/
IMAP.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<?php
/*
* File: IMAP.php
* Category: -
* Author: M.Goldenbaum
* Created: 14.03.19 18:22
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP;
/**
* Class IMAP
*
* Independent imap const holder
*/
class IMAP {
/**
* Message const
*
* @const integer TYPE_TEXT
* @const integer TYPE_MULTIPART
*
* @const integer ENC_7BIT
* @const integer ENC_8BIT
* @const integer ENC_BINARY
* @const integer ENC_BASE64
* @const integer ENC_QUOTED_PRINTABLE
* @const integer ENC_OTHER
*/
const MESSAGE_TYPE_TEXT = 0;
const MESSAGE_TYPE_MULTIPART = 1;
const MESSAGE_ENC_7BIT = 0;
const MESSAGE_ENC_8BIT = 1;
const MESSAGE_ENC_BINARY = 2;
const MESSAGE_ENC_BASE64 = 3;
const MESSAGE_ENC_QUOTED_PRINTABLE = 4;
const MESSAGE_ENC_OTHER = 5;
const MESSAGE_PRIORITY_UNKNOWN = 0;
const MESSAGE_PRIORITY_HIGHEST = 1;
const MESSAGE_PRIORITY_HIGH = 2;
const MESSAGE_PRIORITY_NORMAL = 3;
const MESSAGE_PRIORITY_LOW = 4;
const MESSAGE_PRIORITY_LOWEST = 5;
/**
* Attachment const
*
* @const integer TYPE_TEXT
* @const integer TYPE_MULTIPART
* @const integer TYPE_MESSAGE
* @const integer TYPE_APPLICATION
* @const integer TYPE_AUDIO
* @const integer TYPE_IMAGE
* @const integer TYPE_VIDEO
* @const integer TYPE_MODEL
* @const integer TYPE_OTHER
*/
const ATTACHMENT_TYPE_TEXT = 0;
const ATTACHMENT_TYPE_MULTIPART = 1;
const ATTACHMENT_TYPE_MESSAGE = 2;
const ATTACHMENT_TYPE_APPLICATION = 3;
const ATTACHMENT_TYPE_AUDIO = 4;
const ATTACHMENT_TYPE_IMAGE = 5;
const ATTACHMENT_TYPE_VIDEO = 6;
const ATTACHMENT_TYPE_MODEL = 7;
const ATTACHMENT_TYPE_OTHER = 8;
/**
* Client const
*
* @const integer CLIENT_OPENTIMEOUT
* @const integer CLIENT_READTIMEOUT
* @const integer CLIENT_WRITETIMEOUT
* @const integer CLIENT_CLOSETIMEOUT
*/
const CLIENT_OPENTIMEOUT = 1;
const CLIENT_READTIMEOUT = 2;
const CLIENT_WRITETIMEOUT = 3;
const CLIENT_CLOSETIMEOUT = 4;
/**
* Generic imap const
*
* @const integer NIL
* @const integer IMAP_OPENTIMEOUT
* @const integer IMAP_READTIMEOUT
* @const integer IMAP_WRITETIMEOUT
* @const integer IMAP_CLOSETIMEOUT
* @const integer OP_DEBUG
* @const integer OP_READONLY
* @const integer OP_ANONYMOUS
* @const integer OP_SHORTCACHE
* @const integer OP_SILENT
* @const integer OP_PROTOTYPE
* @const integer OP_HALFOPEN
* @const integer OP_EXPUNGE
* @const integer OP_SECURE
* @const integer CL_EXPUNGE
* @const integer FT_UID
* @const integer FT_PEEK
* @const integer FT_NOT
* @const integer FT_INTERNAL
* @const integer FT_PREFETCHTEXT
* @const integer ST_UID
* @const integer ST_SILENT
* @const integer ST_SET
* @const integer CP_UID
* @const integer CP_MOVE
* @const integer SE_UID
* @const integer SE_FREE
* @const integer SE_NOPREFETCH
* @const integer SO_FREE
* @const integer SO_NOSERVER
* @const integer SA_MESSAGES
* @const integer SA_RECENT
* @const integer SA_UNSEEN
* @const integer SA_UIDNEXT
* @const integer SA_UIDVALIDITY
* @const integer SA_ALL
* @const integer LATT_NOINFERIORS
* @const integer LATT_NOSELECT
* @const integer LATT_MARKED
* @const integer LATT_UNMARKED
* @const integer LATT_REFERRAL
* @const integer LATT_HASCHILDREN
* @const integer LATT_HASNOCHILDREN
* @const integer SORTDATE
* @const integer SORTARRIVAL
* @const integer SORTFROM
* @const integer SORTSUBJECT
* @const integer SORTTO
* @const integer SORTCC
* @const integer SORTSIZE
* @const integer TYPETEXT
* @const integer TYPEMULTIPART
* @const integer TYPEMESSAGE
* @const integer TYPEAPPLICATION
* @const integer TYPEAUDIO
* @const integer TYPEIMAGE
* @const integer TYPEVIDEO
* @const integer TYPEMODEL
* @const integer TYPEOTHER
* @const integer ENC7BIT
* @const integer ENC8BIT
* @const integer ENCBINARY
* @const integer ENCBASE64
* @const integer ENCQUOTEDPRINTABLE
* @const integer ENCOTHER
* @const integer IMAP_GC_ELT
* @const integer IMAP_GC_ENV
* @const integer IMAP_GC_TEXTS
*/
const NIL = 0;
const IMAP_OPENTIMEOUT = 1;
const IMAP_READTIMEOUT = 2;
const IMAP_WRITETIMEOUT = 3;
const IMAP_CLOSETIMEOUT = 4;
const OP_DEBUG = 1;
/**
* Open mailbox read-only
* @link http://php.net/manual/en/imap.constants.php
*/
const OP_READONLY = 2;
/**
* Don't use or update a .newsrc for news
* (NNTP only)
* @link http://php.net/manual/en/imap.constants.php
*/
const OP_ANONYMOUS = 4;
const OP_SHORTCACHE = 8;
const OP_SILENT = 16;
const OP_PROTOTYPE = 32;
/**
* For IMAP and NNTP
* names, open a connection but don't open a mailbox.
* @link http://php.net/manual/en/imap.constants.php
*/
const OP_HALFOPEN = 64;
const OP_EXPUNGE = 128;
const OP_SECURE = 256;
/**
* silently expunge the mailbox before closing when
* calling <b>imap_close</b>
* @link http://php.net/manual/en/imap.constants.php
*/
const CL_EXPUNGE = 32768;
/**
* The parameter is a UID
* @link http://php.net/manual/en/imap.constants.php
*/
const FT_UID = 1;
/**
* Do not set the \Seen flag if not already set
* @link http://php.net/manual/en/imap.constants.php
*/
const FT_PEEK = 2;
const FT_NOT = 4;
/**
* The return string is in internal format, will not canonicalize to CRLF.
* @link http://php.net/manual/en/imap.constants.php
*/
const FT_INTERNAL = 8;
const FT_PREFETCHTEXT = 32;
/**
* The sequence argument contains UIDs instead of sequence numbers
* @link http://php.net/manual/en/imap.constants.php
*/
const ST_UID = 1;
const ST_SILENT = 2;
const ST_MSGN = 3;
const ST_SET = 4;
/**
* the sequence numbers contain UIDS
* @link http://php.net/manual/en/imap.constants.php
*/
const CP_UID = 1;
/**
* Delete the messages from the current mailbox after copying
* with <b>imap_mail_copy</b>
* @link http://php.net/manual/en/imap.constants.php
*/
const CP_MOVE = 2;
/**
* Return UIDs instead of sequence numbers
* @link http://php.net/manual/en/imap.constants.php
*/
const SE_UID = 1;
const SE_FREE = 2;
/**
* Don't prefetch searched messages
* @link http://php.net/manual/en/imap.constants.php
*/
const SE_NOPREFETCH = 4;
const SO_FREE = 8;
const SO_NOSERVER = 16;
const SA_MESSAGES = 1;
const SA_RECENT = 2;
const SA_UNSEEN = 4;
const SA_UIDNEXT = 8;
const SA_UIDVALIDITY = 16;
const SA_ALL = 31;
/**
* This mailbox has no "children" (there are no
* mailboxes below this one).
* @link http://php.net/manual/en/imap.constants.php
*/
const LATT_NOINFERIORS = 1;
/**
* This is only a container, not a mailbox - you
* cannot open it.
* @link http://php.net/manual/en/imap.constants.php
*/
const LATT_NOSELECT = 2;
/**
* This mailbox is marked. Only used by UW-IMAPD.
* @link http://php.net/manual/en/imap.constants.php
*/
const LATT_MARKED = 4;
/**
* This mailbox is not marked. Only used by
* UW-IMAPD.
* @link http://php.net/manual/en/imap.constants.php
*/
const LATT_UNMARKED = 8;
const LATT_REFERRAL = 16;
const LATT_HASCHILDREN = 32;
const LATT_HASNOCHILDREN = 64;
/**
* Sort criteria for <b>imap_sort</b>:
* message Date
* @link http://php.net/manual/en/imap.constants.php
*/
const SORTDATE = 0;
/**
* Sort criteria for <b>imap_sort</b>:
* arrival date
* @link http://php.net/manual/en/imap.constants.php
*/
const SORTARRIVAL = 1;
/**
* Sort criteria for <b>imap_sort</b>:
* mailbox in first From address
* @link http://php.net/manual/en/imap.constants.php
*/
const SORTFROM = 2;
/**
* Sort criteria for <b>imap_sort</b>:
* message subject
* @link http://php.net/manual/en/imap.constants.php
*/
const SORTSUBJECT = 3;
/**
* Sort criteria for <b>imap_sort</b>:
* mailbox in first To address
* @link http://php.net/manual/en/imap.constants.php
*/
const SORTTO = 4;
/**
* Sort criteria for <b>imap_sort</b>:
* mailbox in first cc address
* @link http://php.net/manual/en/imap.constants.php
*/
const SORTCC = 5;
/**
* Sort criteria for <b>imap_sort</b>:
* size of message in octets
* @link http://php.net/manual/en/imap.constants.php
*/
const SORTSIZE = 6;
const TYPETEXT = 0;
const TYPEMULTIPART = 1;
const TYPEMESSAGE = 2;
const TYPEAPPLICATION = 3;
const TYPEAUDIO = 4;
const TYPEIMAGE = 5;
const TYPEVIDEO = 6;
const TYPEMODEL = 7;
const TYPEOTHER = 8;
const ENC7BIT = 0;
const ENC8BIT = 1;
const ENCBINARY = 2;
const ENCBASE64 = 3;
const ENCQUOTEDPRINTABLE = 4;
const ENCOTHER = 5;
/**
* Garbage collector, clear message cache elements.
* @link http://php.net/manual/en/imap.constants.php
*/
const IMAP_GC_ELT = 1;
/**
* Garbage collector, clear envelopes and bodies.
* @link http://php.net/manual/en/imap.constants.php
*/
const IMAP_GC_ENV = 2;
/**
* Garbage collector, clear texts.
* @link http://php.net/manual/en/imap.constants.php
*/
const IMAP_GC_TEXTS = 4;
}