IMAP.php 9.7 KB

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