PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / trunk
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress vtrunk
4.17.2 4.17.1 4.17.0 4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / third-party / vendor / thecodingmachine / safe / generated / imap.php
wp-user-avatar / third-party / vendor / thecodingmachine / safe / generated Last commit date
Exceptions 5 days ago apache.php 5 days ago apcu.php 5 days ago array.php 5 days ago bzip2.php 5 days ago calendar.php 5 days ago classobj.php 5 days ago com.php 5 days ago cubrid.php 5 days ago curl.php 5 days ago datetime.php 5 days ago dir.php 5 days ago eio.php 5 days ago errorfunc.php 5 days ago exec.php 5 days ago fileinfo.php 5 days ago filesystem.php 5 days ago filter.php 5 days ago fpm.php 5 days ago ftp.php 5 days ago funchand.php 5 days ago functionsList.php 5 days ago gmp.php 5 days ago gnupg.php 5 days ago hash.php 5 days ago ibase.php 5 days ago ibmDb2.php 5 days ago iconv.php 5 days ago image.php 5 days ago imap.php 5 days ago info.php 5 days ago ingres-ii.php 5 days ago inotify.php 5 days ago json.php 5 days ago ldap.php 5 days ago libxml.php 5 days ago lzf.php 5 days ago mailparse.php 5 days ago mbstring.php 5 days ago misc.php 5 days ago msql.php 5 days ago mysql.php 5 days ago mysqli.php 5 days ago mysqlndMs.php 5 days ago mysqlndQc.php 5 days ago network.php 5 days ago oci8.php 5 days ago opcache.php 5 days ago openssl.php 5 days ago outcontrol.php 5 days ago password.php 5 days ago pcntl.php 5 days ago pcre.php 5 days ago pdf.php 5 days ago pgsql.php 5 days ago posix.php 5 days ago ps.php 5 days ago pspell.php 5 days ago readline.php 5 days ago rpminfo.php 5 days ago rrd.php 5 days ago sem.php 5 days ago session.php 5 days ago shmop.php 5 days ago simplexml.php 5 days ago sockets.php 5 days ago sodium.php 5 days ago solr.php 5 days ago spl.php 5 days ago sqlsrv.php 5 days ago ssdeep.php 5 days ago ssh2.php 5 days ago stream.php 5 days ago strings.php 5 days ago swoole.php 5 days ago uodbc.php 5 days ago uopz.php 5 days ago url.php 5 days ago var.php 5 days ago xdiff.php 5 days ago xml.php 5 days ago xmlrpc.php 5 days ago yaml.php 5 days ago yaz.php 5 days ago zip.php 5 days ago zlib.php 5 days ago
imap.php
1425 lines
1 <?php
2
3 namespace ProfilePressVendor\Safe;
4
5 use ProfilePressVendor\Safe\Exceptions\ImapException;
6 /**
7 * Appends a string message to the specified mailbox.
8 *
9 * @param resource $imap_stream An IMAP stream returned by
10 * imap_open.
11 * @param string $mailbox The mailbox name, see imap_open for more
12 * information
13 * @param string $message The message to be append, as a string
14 *
15 * When talking to the Cyrus IMAP server, you must use "\r\n" as
16 * your end-of-line terminator instead of "\n" or the operation will
17 * fail
18 * @param string $options If provided, the options will also be written
19 * to the mailbox
20 * @param string $internal_date If this parameter is set, it will set the INTERNALDATE on the appended message. The parameter should be a date string that conforms to the rfc2060 specifications for a date_time value.
21 * @throws ImapException
22 *
23 */
24 function imap_append($imap_stream, string $mailbox, string $message, string $options = null, string $internal_date = null): void
25 {
26 error_clear_last();
27 $result = \imap_append($imap_stream, $mailbox, $message, $options, $internal_date);
28 if ($result === \false) {
29 throw ImapException::createFromPhpError();
30 }
31 }
32 /**
33 * Checks information about the current mailbox.
34 *
35 * @param resource $imap_stream An IMAP stream returned by
36 * imap_open.
37 * @return \stdClass Returns the information in an object with following properties:
38 *
39 *
40 *
41 * Date - current system time formatted according to RFC2822
42 *
43 *
44 *
45 *
46 * Driver - protocol used to access this mailbox:
47 * POP3, IMAP, NNTP
48 *
49 *
50 *
51 *
52 * Mailbox - the mailbox name
53 *
54 *
55 *
56 *
57 * Nmsgs - number of messages in the mailbox
58 *
59 *
60 *
61 *
62 * Recent - number of recent messages in the mailbox
63 *
64 *
65 *
66 *
67 * Returns FALSE on failure.
68 * @throws ImapException
69 *
70 */
71 function imap_check($imap_stream): \stdClass
72 {
73 error_clear_last();
74 $result = \imap_check($imap_stream);
75 if ($result === \false) {
76 throw ImapException::createFromPhpError();
77 }
78 return $result;
79 }
80 /**
81 * This function causes a store to delete the specified
82 * flag to the flags set for the
83 * messages in the specified sequence.
84 *
85 * @param resource $imap_stream An IMAP stream returned by
86 * imap_open.
87 * @param string $sequence A sequence of message numbers. You can enumerate desired messages
88 * with the X,Y syntax, or retrieve all messages
89 * within an interval with the X:Y syntax
90 * @param string $flag The flags which you can unset are "\\Seen", "\\Answered", "\\Flagged",
91 * "\\Deleted", and "\\Draft" (as defined by RFC2060)
92 * @param int $options options are a bit mask and may contain
93 * the single option:
94 *
95 *
96 *
97 * ST_UID - The sequence argument contains UIDs
98 * instead of sequence numbers
99 *
100 *
101 *
102 * @throws ImapException
103 *
104 */
105 function imap_clearflag_full($imap_stream, string $sequence, string $flag, int $options = 0): void
106 {
107 error_clear_last();
108 $result = \imap_clearflag_full($imap_stream, $sequence, $flag, $options);
109 if ($result === \false) {
110 throw ImapException::createFromPhpError();
111 }
112 }
113 /**
114 * Closes the imap stream.
115 *
116 * @param resource $imap_stream An IMAP stream returned by
117 * imap_open.
118 * @param int $flag If set to CL_EXPUNGE, the function will silently
119 * expunge the mailbox before closing, removing all messages marked for
120 * deletion. You can achieve the same thing by using
121 * imap_expunge
122 * @throws ImapException
123 *
124 */
125 function imap_close($imap_stream, int $flag = 0): void
126 {
127 error_clear_last();
128 $result = \imap_close($imap_stream, $flag);
129 if ($result === \false) {
130 throw ImapException::createFromPhpError();
131 }
132 }
133 /**
134 * Creates a new mailbox specified by mailbox.
135 *
136 * @param resource $imap_stream An IMAP stream returned by
137 * imap_open.
138 * @param string $mailbox The mailbox name, see imap_open for more
139 * information. Names containing international characters should be
140 * encoded by imap_utf7_encode
141 * @throws ImapException
142 *
143 */
144 function imap_createmailbox($imap_stream, string $mailbox): void
145 {
146 error_clear_last();
147 $result = \imap_createmailbox($imap_stream, $mailbox);
148 if ($result === \false) {
149 throw ImapException::createFromPhpError();
150 }
151 }
152 /**
153 * Deletes the specified mailbox.
154 *
155 * @param resource $imap_stream An IMAP stream returned by
156 * imap_open.
157 * @param string $mailbox The mailbox name, see imap_open for more
158 * information
159 * @throws ImapException
160 *
161 */
162 function imap_deletemailbox($imap_stream, string $mailbox): void
163 {
164 error_clear_last();
165 $result = \imap_deletemailbox($imap_stream, $mailbox);
166 if ($result === \false) {
167 throw ImapException::createFromPhpError();
168 }
169 }
170 /**
171 * Fetches all the structured information for a given message.
172 *
173 * @param resource $imap_stream An IMAP stream returned by
174 * imap_open.
175 * @param int $msg_number The message number
176 * @param int $options This optional parameter only has a single option,
177 * FT_UID, which tells the function to treat the
178 * msg_number argument as a
179 * UID.
180 * @return \stdClass Returns an object with properties listed in the table below.
181 *
182 *
183 *
184 * Returned Object for imap_fetchstructure
185 *
186 *
187 *
188 *
189 * type
190 * Primary body type
191 *
192 *
193 * encoding
194 * Body transfer encoding
195 *
196 *
197 * ifsubtype
198 * TRUE if there is a subtype string
199 *
200 *
201 * subtype
202 * MIME subtype
203 *
204 *
205 * ifdescription
206 * TRUE if there is a description string
207 *
208 *
209 * description
210 * Content description string
211 *
212 *
213 * ifid
214 * TRUE if there is an identification string
215 *
216 *
217 * id
218 * Identification string
219 *
220 *
221 * lines
222 * Number of lines
223 *
224 *
225 * bytes
226 * Number of bytes
227 *
228 *
229 * ifdisposition
230 * TRUE if there is a disposition string
231 *
232 *
233 * disposition
234 * Disposition string
235 *
236 *
237 * ifdparameters
238 * TRUE if the dparameters array exists
239 *
240 *
241 * dparameters
242 * An array of objects where each object has an
243 * "attribute" and a "value"
244 * property corresponding to the parameters on the
245 * Content-disposition MIME
246 * header.
247 *
248 *
249 * ifparameters
250 * TRUE if the parameters array exists
251 *
252 *
253 * parameters
254 * An array of objects where each object has an
255 * "attribute" and a "value"
256 * property.
257 *
258 *
259 * parts
260 * An array of objects identical in structure to the top-level
261 * object, each of which corresponds to a MIME body
262 * part.
263 *
264 *
265 *
266 *
267 *
268 *
269 * Primary body type (value may vary with used library, use of constants is recommended)
270 *
271 *
272 * ValueTypeConstant
273 *
274 *
275 * 0textTYPETEXT
276 * 1multipartTYPEMULTIPART
277 * 2messageTYPEMESSAGE
278 * 3applicationTYPEAPPLICATION
279 * 4audioTYPEAUDIO
280 * 5imageTYPEIMAGE
281 * 6videoTYPEVIDEO
282 * 7modelTYPEMODEL
283 * 8otherTYPEOTHER
284 *
285 *
286 *
287 *
288 *
289 * Transfer encodings (value may vary with used library, use of constants is recommended)
290 *
291 *
292 * ValueTypeConstant
293 *
294 *
295 * 07bitENC7BIT
296 * 18bitENC8BIT
297 * 2BinaryENCBINARY
298 * 3Base64ENCBASE64
299 * 4Quoted-PrintableENCQUOTEDPRINTABLE
300 * 5otherENCOTHER
301 *
302 *
303 *
304 * @throws ImapException
305 *
306 */
307 function imap_fetchstructure($imap_stream, int $msg_number, int $options = 0): \stdClass
308 {
309 error_clear_last();
310 $result = \imap_fetchstructure($imap_stream, $msg_number, $options);
311 if ($result === \false) {
312 throw ImapException::createFromPhpError();
313 }
314 return $result;
315 }
316 /**
317 * Purges the cache of entries of a specific type.
318 *
319 * @param resource $imap_stream An IMAP stream returned by
320 * imap_open.
321 * @param int $caches Specifies the cache to purge. It may one or a combination
322 * of the following constants:
323 * IMAP_GC_ELT (message cache elements),
324 * IMAP_GC_ENV (envelope and bodies),
325 * IMAP_GC_TEXTS (texts).
326 * @throws ImapException
327 *
328 */
329 function imap_gc($imap_stream, int $caches): void
330 {
331 error_clear_last();
332 $result = \imap_gc($imap_stream, $caches);
333 if ($result === \false) {
334 throw ImapException::createFromPhpError();
335 }
336 }
337 /**
338 * Gets information about the given message number by reading its headers.
339 *
340 * @param resource $imap_stream An IMAP stream returned by
341 * imap_open.
342 * @param int $msg_number The message number
343 * @param int $fromlength Number of characters for the fetchfrom property.
344 * Must be greater than or equal to zero.
345 * @param int $subjectlength Number of characters for the fetchsubject property
346 * Must be greater than or equal to zero.
347 * @param string $defaulthost
348 * @return \stdClass Returns FALSE on error or, if successful, the information in an object with following properties:
349 *
350 *
351 *
352 * toaddress - full to: line, up to 1024 characters
353 *
354 *
355 *
356 *
357 * to - an array of objects from the To: line, with the following
358 * properties: personal, adl,
359 * mailbox, and host
360 *
361 *
362 *
363 *
364 * fromaddress - full from: line, up to 1024 characters
365 *
366 *
367 *
368 *
369 * from - an array of objects from the From: line, with the following
370 * properties: personal, adl,
371 * mailbox, and host
372 *
373 *
374 *
375 *
376 * ccaddress - full cc: line, up to 1024 characters
377 *
378 *
379 *
380 *
381 * cc - an array of objects from the Cc: line, with the following
382 * properties: personal, adl,
383 * mailbox, and host
384 *
385 *
386 *
387 *
388 * bccaddress - full bcc: line, up to 1024 characters
389 *
390 *
391 *
392 *
393 * bcc - an array of objects from the Bcc: line, with the following
394 * properties: personal, adl,
395 * mailbox, and host
396 *
397 *
398 *
399 *
400 * reply_toaddress - full Reply-To: line, up to 1024 characters
401 *
402 *
403 *
404 *
405 * reply_to - an array of objects from the Reply-To: line, with the following
406 * properties: personal, adl,
407 * mailbox, and host
408 *
409 *
410 *
411 *
412 * senderaddress - full sender: line, up to 1024 characters
413 *
414 *
415 *
416 *
417 * sender - an array of objects from the Sender: line, with the following
418 * properties: personal, adl,
419 * mailbox, and host
420 *
421 *
422 *
423 *
424 * return_pathaddress - full Return-Path: line, up to 1024 characters
425 *
426 *
427 *
428 *
429 * return_path - an array of objects from the Return-Path: line, with the
430 * following properties: personal,
431 * adl, mailbox, and
432 * host
433 *
434 *
435 *
436 *
437 * remail -
438 *
439 *
440 *
441 *
442 * date - The message date as found in its headers
443 *
444 *
445 *
446 *
447 * Date - Same as date
448 *
449 *
450 *
451 *
452 * subject - The message subject
453 *
454 *
455 *
456 *
457 * Subject - Same as subject
458 *
459 *
460 *
461 *
462 * in_reply_to -
463 *
464 *
465 *
466 *
467 * message_id -
468 *
469 *
470 *
471 *
472 * newsgroups -
473 *
474 *
475 *
476 *
477 * followup_to -
478 *
479 *
480 *
481 *
482 * references -
483 *
484 *
485 *
486 *
487 * Recent - R if recent and seen, N
488 * if recent and not seen, ' ' if not recent.
489 *
490 *
491 *
492 *
493 * Unseen - U if not seen AND not recent, ' ' if seen
494 * OR not seen and recent
495 *
496 *
497 *
498 *
499 * Flagged - F if flagged, ' ' if not flagged
500 *
501 *
502 *
503 *
504 * Answered - A if answered, ' ' if unanswered
505 *
506 *
507 *
508 *
509 * Deleted - D if deleted, ' ' if not deleted
510 *
511 *
512 *
513 *
514 * Draft - X if draft, ' ' if not draft
515 *
516 *
517 *
518 *
519 * Msgno - The message number
520 *
521 *
522 *
523 *
524 * MailDate -
525 *
526 *
527 *
528 *
529 * Size - The message size
530 *
531 *
532 *
533 *
534 * udate - mail message date in Unix time
535 *
536 *
537 *
538 *
539 * fetchfrom - from line formatted to fit fromlength
540 * characters
541 *
542 *
543 *
544 *
545 * fetchsubject - subject line formatted to fit
546 * subjectlength characters
547 *
548 *
549 *
550 * @throws ImapException
551 *
552 */
553 function imap_headerinfo($imap_stream, int $msg_number, int $fromlength = 0, int $subjectlength = 0, string $defaulthost = null): \stdClass
554 {
555 error_clear_last();
556 $result = \imap_headerinfo($imap_stream, $msg_number, $fromlength, $subjectlength, $defaulthost);
557 if ($result === \false) {
558 throw ImapException::createFromPhpError();
559 }
560 return $result;
561 }
562 /**
563 * Create a MIME message based on the given envelope
564 * and body sections.
565 *
566 * @param array $envelope An associative array of header fields. Valid keys are: "remail",
567 * "return_path", "date", "from", "reply_to", "in_reply_to", "subject",
568 * "to", "cc", "bcc" and "message_id", which set the respective message headers to the given string.
569 * To set additional headers, the key "custom_headers" is supported, which expects
570 * an array of those headers, e.g. ["User-Agent: My Mail Client"].
571 * @param array $body An indexed array of bodies. The first body is the main body of the message;
572 * only if it has a type of TYPEMULTIPART, further bodies
573 * are processed; these bodies constitute the bodies of the parts.
574 *
575 *
576 * Body Array Structure
577 *
578 *
579 *
580 * Key
581 * Type
582 * Description
583 *
584 *
585 *
586 *
587 * type
588 * int
589 *
590 * The MIME type.
591 * One of TYPETEXT (default), TYPEMULTIPART,
592 * TYPEMESSAGE, TYPEAPPLICATION,
593 * TYPEAUDIO, TYPEIMAGE,
594 * TYPEMODEL or TYPEOTHER.
595 *
596 *
597 *
598 * encoding
599 * int
600 *
601 * The Content-Transfer-Encoding.
602 * One of ENC7BIT (default), ENC8BIT,
603 * ENCBINARY, ENCBASE64,
604 * ENCQUOTEDPRINTABLE or ENCOTHER.
605 *
606 *
607 *
608 * charset
609 * string
610 * The charset parameter of the MIME type.
611 *
612 *
613 * type.parameters
614 * array
615 * An associative array of Content-Type parameter names and their values.
616 *
617 *
618 * subtype
619 * string
620 * The MIME subtype, e.g. 'jpeg' for TYPEIMAGE.
621 *
622 *
623 * id
624 * string
625 * The Content-ID.
626 *
627 *
628 * description
629 * string
630 * The Content-Description.
631 *
632 *
633 * disposition.type
634 * string
635 * The Content-Disposition, e.g. 'attachment'.
636 *
637 *
638 * disposition
639 * array
640 * An associative array of Content-Disposition parameter names and values.
641 *
642 *
643 * contents.data
644 * string
645 * The payload.
646 *
647 *
648 * lines
649 * int
650 * The size of the payload in lines.
651 *
652 *
653 * bytes
654 * int
655 * The size of the payload in bytes.
656 *
657 *
658 * md5
659 * string
660 * The MD5 checksum of the payload.
661 *
662 *
663 *
664 *
665 * @return string Returns the MIME message as string.
666 * @throws ImapException
667 *
668 */
669 function imap_mail_compose(array $envelope, array $body): string
670 {
671 error_clear_last();
672 $result = \imap_mail_compose($envelope, $body);
673 if ($result === \false) {
674 throw ImapException::createFromPhpError();
675 }
676 return $result;
677 }
678 /**
679 * Copies mail messages specified by msglist
680 * to specified mailbox.
681 *
682 * @param resource $imap_stream An IMAP stream returned by
683 * imap_open.
684 * @param string $msglist msglist is a range not just message
685 * numbers (as described in RFC2060).
686 * @param string $mailbox The mailbox name, see imap_open for more
687 * information
688 * @param int $options options is a bitmask of one or more of
689 *
690 *
691 *
692 * CP_UID - the sequence numbers contain UIDS
693 *
694 *
695 *
696 *
697 * CP_MOVE - Delete the messages from
698 * the current mailbox after copying
699 *
700 *
701 *
702 * @throws ImapException
703 *
704 */
705 function imap_mail_copy($imap_stream, string $msglist, string $mailbox, int $options = 0): void
706 {
707 error_clear_last();
708 $result = \imap_mail_copy($imap_stream, $msglist, $mailbox, $options);
709 if ($result === \false) {
710 throw ImapException::createFromPhpError();
711 }
712 }
713 /**
714 * Moves mail messages specified by msglist to the
715 * specified mailbox.
716 *
717 * @param resource $imap_stream An IMAP stream returned by
718 * imap_open.
719 * @param string $msglist msglist is a range not just message numbers
720 * (as described in RFC2060).
721 * @param string $mailbox The mailbox name, see imap_open for more
722 * information
723 * @param int $options options is a bitmask and may contain the single option:
724 *
725 *
726 *
727 * CP_UID - the sequence numbers contain UIDS
728 *
729 *
730 *
731 * @throws ImapException
732 *
733 */
734 function imap_mail_move($imap_stream, string $msglist, string $mailbox, int $options = 0): void
735 {
736 error_clear_last();
737 $result = \imap_mail_move($imap_stream, $msglist, $mailbox, $options);
738 if ($result === \false) {
739 throw ImapException::createFromPhpError();
740 }
741 }
742 /**
743 * This function allows sending of emails with correct handling of
744 * Cc and Bcc receivers.
745 *
746 * The parameters to, cc
747 * and bcc are all strings and are all parsed
748 * as RFC822 address lists.
749 *
750 * @param string $to The receiver
751 * @param string $subject The mail subject
752 * @param string $message The mail body, see imap_mail_compose
753 * @param string $additional_headers As string with additional headers to be set on the mail
754 * @param string $cc
755 * @param string $bcc The receivers specified in bcc will get the
756 * mail, but are excluded from the headers.
757 * @param string $rpath Use this parameter to specify return path upon mail delivery failure.
758 * This is useful when using PHP as a mail client for multiple users.
759 * @throws ImapException
760 *
761 */
762 function imap_mail(string $to, string $subject, string $message, string $additional_headers = null, string $cc = null, string $bcc = null, string $rpath = null): void
763 {
764 error_clear_last();
765 $result = \imap_mail($to, $subject, $message, $additional_headers, $cc, $bcc, $rpath);
766 if ($result === \false) {
767 throw ImapException::createFromPhpError();
768 }
769 }
770 /**
771 * Checks the current mailbox status on the server. It is similar to
772 * imap_status, but will additionally sum up the size of
773 * all messages in the mailbox, which will take some additional time to
774 * execute.
775 *
776 * @param resource $imap_stream An IMAP stream returned by
777 * imap_open.
778 * @return \stdClass Returns the information in an object with following properties:
779 *
780 * Mailbox properties
781 *
782 *
783 *
784 * Date
785 * date of last change (current datetime)
786 *
787 *
788 * Driver
789 * driver
790 *
791 *
792 * Mailbox
793 * name of the mailbox
794 *
795 *
796 * Nmsgs
797 * number of messages
798 *
799 *
800 * Recent
801 * number of recent messages
802 *
803 *
804 * Unread
805 * number of unread messages
806 *
807 *
808 * Deleted
809 * number of deleted messages
810 *
811 *
812 * Size
813 * mailbox size
814 *
815 *
816 *
817 *
818 *
819 * Returns FALSE on failure.
820 * @throws ImapException
821 *
822 */
823 function imap_mailboxmsginfo($imap_stream): \stdClass
824 {
825 error_clear_last();
826 $result = \imap_mailboxmsginfo($imap_stream);
827 if ($result === \false) {
828 throw ImapException::createFromPhpError();
829 }
830 return $result;
831 }
832 /**
833 * Decode a modified UTF-7 (as specified in RFC 2060, section 5.1.3) string to UTF-8.
834 *
835 * @param string $in A string encoded in modified UTF-7.
836 * @return string Returns in converted to UTF-8.
837 * @throws ImapException
838 *
839 */
840 function imap_mutf7_to_utf8(string $in): string
841 {
842 error_clear_last();
843 $result = \imap_mutf7_to_utf8($in);
844 if ($result === \false) {
845 throw ImapException::createFromPhpError();
846 }
847 return $result;
848 }
849 /**
850 * Gets the number of messages in the current mailbox.
851 *
852 * @param resource $imap_stream An IMAP stream returned by
853 * imap_open.
854 * @return int Return the number of messages in the current mailbox, as an integer.
855 * @throws ImapException
856 *
857 */
858 function imap_num_msg($imap_stream): int
859 {
860 error_clear_last();
861 $result = \imap_num_msg($imap_stream);
862 if ($result === \false) {
863 throw ImapException::createFromPhpError();
864 }
865 return $result;
866 }
867 /**
868 * Opens an IMAP stream to a mailbox.
869 *
870 * This function can also be used to open streams to POP3 and
871 * NNTP servers, but some functions and features are only
872 * available on IMAP servers.
873 *
874 * @param string $mailbox A mailbox name consists of a server and a mailbox path on this server.
875 * The special name INBOX stands for the current users
876 * personal mailbox. Mailbox names that contain international characters
877 * besides those in the printable ASCII space have to be encoded with
878 * imap_utf7_encode.
879 *
880 * The server part, which is enclosed in '{' and '}', consists of the servers
881 * name or ip address, an optional port (prefixed by ':'), and an optional
882 * protocol specification (prefixed by '/').
883 *
884 * The server part is mandatory in all mailbox
885 * parameters.
886 *
887 * All names which start with { are remote names, and are
888 * in the form "{" remote_system_name [":" port] [flags] "}"
889 * [mailbox_name] where:
890 *
891 *
892 *
893 * remote_system_name - Internet domain name or
894 * bracketed IP address of server.
895 *
896 *
897 *
898 *
899 * port - optional TCP port number, default is the
900 * default port for that service
901 *
902 *
903 *
904 *
905 * flags - optional flags, see following table.
906 *
907 *
908 *
909 *
910 * mailbox_name - remote mailbox name, default is INBOX
911 *
912 *
913 *
914 *
915 *
916 * Optional flags for names
917 *
918 *
919 *
920 * Flag
921 * Description
922 *
923 *
924 *
925 *
926 * /service=service
927 * mailbox access service, default is "imap"
928 *
929 *
930 * /user=user
931 * remote user name for login on the server
932 *
933 *
934 * /authuser=user
935 * remote authentication user; if specified this is the user name
936 * whose password is used (e.g. administrator)
937 *
938 *
939 * /anonymous
940 * remote access as anonymous user
941 *
942 *
943 * /debug
944 * record protocol telemetry in application's debug log
945 *
946 *
947 * /secure
948 * do not transmit a plaintext password over the network
949 *
950 *
951 * /imap, /imap2,
952 * /imap2bis, /imap4,
953 * /imap4rev1
954 * equivalent to /service=imap
955 *
956 *
957 * /pop3
958 * equivalent to /service=pop3
959 *
960 *
961 * /nntp
962 * equivalent to /service=nntp
963 *
964 *
965 * /norsh
966 * do not use rsh or ssh to establish a preauthenticated IMAP
967 * session
968 *
969 *
970 * /ssl
971 * use the Secure Socket Layer to encrypt the session
972 *
973 *
974 * /validate-cert
975 * validate certificates from TLS/SSL server (this is the default
976 * behavior)
977 *
978 *
979 * /novalidate-cert
980 * do not validate certificates from TLS/SSL server, needed if
981 * server uses self-signed certificates
982 *
983 *
984 * /tls
985 * force use of start-TLS to encrypt the session, and reject
986 * connection to servers that do not support it
987 *
988 *
989 * /notls
990 * do not do start-TLS to encrypt the session, even with servers
991 * that support it
992 *
993 *
994 * /readonly
995 * request read-only mailbox open (IMAP only; ignored on NNTP, and
996 * an error with SMTP and POP3)
997 *
998 *
999 *
1000 *
1001 * @param string $username The user name
1002 * @param string $password The password associated with the username
1003 * @param int $options The options are a bit mask with one or more of
1004 * the following:
1005 *
1006 *
1007 *
1008 * OP_READONLY - Open mailbox read-only
1009 *
1010 *
1011 *
1012 *
1013 * OP_ANONYMOUS - Don't use or update a
1014 * .newsrc for news (NNTP only)
1015 *
1016 *
1017 *
1018 *
1019 * OP_HALFOPEN - For IMAP
1020 * and NNTP names, open a connection but
1021 * don't open a mailbox.
1022 *
1023 *
1024 *
1025 *
1026 * CL_EXPUNGE - Expunge mailbox automatically upon mailbox close
1027 * (see also imap_delete and
1028 * imap_expunge)
1029 *
1030 *
1031 *
1032 *
1033 * OP_DEBUG - Debug protocol negotiations
1034 *
1035 *
1036 *
1037 *
1038 * OP_SHORTCACHE - Short (elt-only) caching
1039 *
1040 *
1041 *
1042 *
1043 * OP_SILENT - Don't pass up events (internal use)
1044 *
1045 *
1046 *
1047 *
1048 * OP_PROTOTYPE - Return driver prototype
1049 *
1050 *
1051 *
1052 *
1053 * OP_SECURE - Don't do non-secure authentication
1054 *
1055 *
1056 *
1057 * @param int $n_retries Number of maximum connect attempts
1058 * @param array|null $params Connection parameters, the following (string) keys maybe used
1059 * to set one or more connection parameters:
1060 *
1061 *
1062 *
1063 * DISABLE_AUTHENTICATOR - Disable authentication properties
1064 *
1065 *
1066 *
1067 * @return resource Returns an IMAP stream on success.
1068 * @throws ImapException
1069 *
1070 */
1071 function imap_open(string $mailbox, string $username, string $password, int $options = 0, int $n_retries = 0, ?array $params = null)
1072 {
1073 error_clear_last();
1074 $result = \imap_open($mailbox, $username, $password, $options, $n_retries, $params);
1075 if ($result === \false) {
1076 throw ImapException::createFromPhpError();
1077 }
1078 return $result;
1079 }
1080 /**
1081 * This function renames on old mailbox to new mailbox (see
1082 * imap_open for the format of
1083 * mbox names).
1084 *
1085 * @param resource $imap_stream An IMAP stream returned by
1086 * imap_open.
1087 * @param string $old_mbox The old mailbox name, see imap_open for more
1088 * information
1089 * @param string $new_mbox The new mailbox name, see imap_open for more
1090 * information
1091 * @throws ImapException
1092 *
1093 */
1094 function imap_renamemailbox($imap_stream, string $old_mbox, string $new_mbox): void
1095 {
1096 error_clear_last();
1097 $result = \imap_renamemailbox($imap_stream, $old_mbox, $new_mbox);
1098 if ($result === \false) {
1099 throw ImapException::createFromPhpError();
1100 }
1101 }
1102 /**
1103 * Saves a part or the whole body of the specified message.
1104 *
1105 * @param resource $imap_stream An IMAP stream returned by
1106 * imap_open.
1107 * @param string|resource $file The path to the saved file as a string, or a valid file descriptor
1108 * returned by fopen.
1109 * @param int $msg_number The message number
1110 * @param string $part_number The part number. It is a string of integers delimited by period which
1111 * index into a body part list as per the IMAP4 specification
1112 * @param int $options A bitmask with one or more of the following:
1113 *
1114 *
1115 *
1116 * FT_UID - The msg_number is a UID
1117 *
1118 *
1119 *
1120 *
1121 * FT_PEEK - Do not set the \Seen flag if
1122 * not already set
1123 *
1124 *
1125 *
1126 *
1127 * FT_INTERNAL - The return string is in
1128 * internal format, will not canonicalize to CRLF.
1129 *
1130 *
1131 *
1132 * @throws ImapException
1133 *
1134 */
1135 function imap_savebody($imap_stream, $file, int $msg_number, string $part_number = "", int $options = 0): void
1136 {
1137 error_clear_last();
1138 $result = \imap_savebody($imap_stream, $file, $msg_number, $part_number, $options);
1139 if ($result === \false) {
1140 throw ImapException::createFromPhpError();
1141 }
1142 }
1143 /**
1144 * Sets an upper limit quota on a per mailbox basis.
1145 *
1146 * @param resource $imap_stream An IMAP stream returned by
1147 * imap_open.
1148 * @param string $quota_root The mailbox to have a quota set. This should follow the IMAP standard
1149 * format for a mailbox: user.name.
1150 * @param int $quota_limit The maximum size (in KB) for the quota_root
1151 * @throws ImapException
1152 *
1153 */
1154 function imap_set_quota($imap_stream, string $quota_root, int $quota_limit): void
1155 {
1156 error_clear_last();
1157 $result = \imap_set_quota($imap_stream, $quota_root, $quota_limit);
1158 if ($result === \false) {
1159 throw ImapException::createFromPhpError();
1160 }
1161 }
1162 /**
1163 * Sets the ACL for a giving mailbox.
1164 *
1165 * @param resource $imap_stream An IMAP stream returned by
1166 * imap_open.
1167 * @param string $mailbox The mailbox name, see imap_open for more
1168 * information
1169 * @param string $id The user to give the rights to.
1170 * @param string $rights The rights to give to the user. Passing an empty string will delete
1171 * acl.
1172 * @throws ImapException
1173 *
1174 */
1175 function imap_setacl($imap_stream, string $mailbox, string $id, string $rights): void
1176 {
1177 error_clear_last();
1178 $result = \imap_setacl($imap_stream, $mailbox, $id, $rights);
1179 if ($result === \false) {
1180 throw ImapException::createFromPhpError();
1181 }
1182 }
1183 /**
1184 * Causes a store to add the specified flag to the
1185 * flags set for the messages in the specified
1186 * sequence.
1187 *
1188 * @param resource $imap_stream An IMAP stream returned by
1189 * imap_open.
1190 * @param string $sequence A sequence of message numbers. You can enumerate desired messages
1191 * with the X,Y syntax, or retrieve all messages
1192 * within an interval with the X:Y syntax
1193 * @param string $flag The flags which you can set are \Seen,
1194 * \Answered, \Flagged,
1195 * \Deleted, and \Draft as
1196 * defined by RFC2060.
1197 * @param int $options A bit mask that may contain the single option:
1198 *
1199 *
1200 *
1201 * ST_UID - The sequence argument contains UIDs
1202 * instead of sequence numbers
1203 *
1204 *
1205 *
1206 * @throws ImapException
1207 *
1208 */
1209 function imap_setflag_full($imap_stream, string $sequence, string $flag, int $options = \NIL): void
1210 {
1211 error_clear_last();
1212 $result = \imap_setflag_full($imap_stream, $sequence, $flag, $options);
1213 if ($result === \false) {
1214 throw ImapException::createFromPhpError();
1215 }
1216 }
1217 /**
1218 * Gets and sorts message numbers by the given parameters.
1219 *
1220 * @param resource $imap_stream An IMAP stream returned by
1221 * imap_open.
1222 * @param int $criteria Criteria can be one (and only one) of the following:
1223 *
1224 *
1225 *
1226 * SORTDATE - message Date
1227 *
1228 *
1229 *
1230 *
1231 * SORTARRIVAL - arrival date
1232 *
1233 *
1234 *
1235 *
1236 * SORTFROM - mailbox in first From address
1237 *
1238 *
1239 *
1240 *
1241 * SORTSUBJECT - message subject
1242 *
1243 *
1244 *
1245 *
1246 * SORTTO - mailbox in first To address
1247 *
1248 *
1249 *
1250 *
1251 * SORTCC - mailbox in first cc address
1252 *
1253 *
1254 *
1255 *
1256 * SORTSIZE - size of message in octets
1257 *
1258 *
1259 *
1260 * @param int $reverse Set this to 1 for reverse sorting
1261 * @param int $options The options are a bitmask of one or more of the
1262 * following:
1263 *
1264 *
1265 *
1266 * SE_UID - Return UIDs instead of sequence numbers
1267 *
1268 *
1269 *
1270 *
1271 * SE_NOPREFETCH - Don't prefetch searched messages
1272 *
1273 *
1274 *
1275 * @param string $search_criteria IMAP2-format search criteria string. For details see
1276 * imap_search.
1277 * @param string $charset MIME character set to use when sorting strings.
1278 * @return array Returns an array of message numbers sorted by the given
1279 * parameters.
1280 * @throws ImapException
1281 *
1282 */
1283 function imap_sort($imap_stream, int $criteria, int $reverse, int $options = 0, string $search_criteria = null, string $charset = null): array
1284 {
1285 error_clear_last();
1286 $result = \imap_sort($imap_stream, $criteria, $reverse, $options, $search_criteria, $charset);
1287 if ($result === \false) {
1288 throw ImapException::createFromPhpError();
1289 }
1290 return $result;
1291 }
1292 /**
1293 * Subscribe to a new mailbox.
1294 *
1295 * @param resource $imap_stream An IMAP stream returned by
1296 * imap_open.
1297 * @param string $mailbox The mailbox name, see imap_open for more
1298 * information
1299 * @throws ImapException
1300 *
1301 */
1302 function imap_subscribe($imap_stream, string $mailbox): void
1303 {
1304 error_clear_last();
1305 $result = \imap_subscribe($imap_stream, $mailbox);
1306 if ($result === \false) {
1307 throw ImapException::createFromPhpError();
1308 }
1309 }
1310 /**
1311 * Gets a tree of a threaded message.
1312 *
1313 * @param resource $imap_stream An IMAP stream returned by
1314 * imap_open.
1315 * @param int $options
1316 * @return array imap_thread returns an associative array containing
1317 * a tree of messages threaded by REFERENCES.
1318 *
1319 * Every message in the current mailbox will be represented by three entries
1320 * in the resulting array:
1321 *
1322 *
1323 * $thread["XX.num"] - current message number
1324 *
1325 *
1326 * $thread["XX.next"]
1327 *
1328 *
1329 * $thread["XX.branch"]
1330 *
1331 *
1332 * @throws ImapException
1333 *
1334 */
1335 function imap_thread($imap_stream, int $options = \SE_FREE): array
1336 {
1337 error_clear_last();
1338 $result = \imap_thread($imap_stream, $options);
1339 if ($result === \false) {
1340 throw ImapException::createFromPhpError();
1341 }
1342 return $result;
1343 }
1344 /**
1345 * Sets or fetches the imap timeout.
1346 *
1347 * @param int $timeout_type One of the following:
1348 * IMAP_OPENTIMEOUT,
1349 * IMAP_READTIMEOUT,
1350 * IMAP_WRITETIMEOUT, or
1351 * IMAP_CLOSETIMEOUT.
1352 * @param int $timeout The timeout, in seconds.
1353 * @return mixed If the timeout parameter is set, this function
1354 * returns TRUE on success.
1355 *
1356 * If timeout is not provided or evaluates to -1,
1357 * the current timeout value of timeout_type is
1358 * returned as an integer.
1359 * @throws ImapException
1360 *
1361 */
1362 function imap_timeout(int $timeout_type, int $timeout = -1)
1363 {
1364 error_clear_last();
1365 $result = \imap_timeout($timeout_type, $timeout);
1366 if ($result === \false) {
1367 throw ImapException::createFromPhpError();
1368 }
1369 return $result;
1370 }
1371 /**
1372 * Removes the deletion flag for a specified message, which is set by
1373 * imap_delete or imap_mail_move.
1374 *
1375 * @param resource $imap_stream An IMAP stream returned by
1376 * imap_open.
1377 * @param int $msg_number The message number
1378 * @param int $flags
1379 * @throws ImapException
1380 *
1381 */
1382 function imap_undelete($imap_stream, int $msg_number, int $flags = 0): void
1383 {
1384 error_clear_last();
1385 $result = \imap_undelete($imap_stream, $msg_number, $flags);
1386 if ($result === \false) {
1387 throw ImapException::createFromPhpError();
1388 }
1389 }
1390 /**
1391 * Unsubscribe from the specified mailbox.
1392 *
1393 * @param resource $imap_stream An IMAP stream returned by
1394 * imap_open.
1395 * @param string $mailbox The mailbox name, see imap_open for more
1396 * information
1397 * @throws ImapException
1398 *
1399 */
1400 function imap_unsubscribe($imap_stream, string $mailbox): void
1401 {
1402 error_clear_last();
1403 $result = \imap_unsubscribe($imap_stream, $mailbox);
1404 if ($result === \false) {
1405 throw ImapException::createFromPhpError();
1406 }
1407 }
1408 /**
1409 * Encode a UTF-8 string to modified UTF-7 (as specified in RFC 2060, section 5.1.3).
1410 *
1411 * @param string $in A UTF-8 encoded string.
1412 * @return string Returns in converted to modified UTF-7.
1413 * @throws ImapException
1414 *
1415 */
1416 function imap_utf8_to_mutf7(string $in): string
1417 {
1418 error_clear_last();
1419 $result = \imap_utf8_to_mutf7($in);
1420 if ($result === \false) {
1421 throw ImapException::createFromPhpError();
1422 }
1423 return $result;
1424 }
1425