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