PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.11.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.11.1
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Libraries / Imap2 / Mail.php

Mail.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.11.1, at back/Libraries/Imap2/Mail.php

74 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the PHP IMAP2 package.
5 *
6 * (c) Francesco Bianco <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace AcyMailing\Libraries\Imap2;
13
14 class Mail
15 {
16 /**
17 * Copy specified messages to a mailbox.
18 *
19 * @param $imap
20 * @param $messageNums
21 * @param $mailbox
22 * @param $flags
23 *
24 * @return false|mixed
25 */
26 public static function copy($imap, $messageNums, $mailbox, $flags = 0)
27 {
28 if (!is_a($imap, Connection::class)) {
29 return Errors::invalidImapConnection(debug_backtrace(), 1, false);
30 }
31
32 if ($flags & CP_MOVE) {
33 return Mail::move($imap, $messageNums, $mailbox, $flags);
34 }
35
36 $client = $imap->getClient();
37
38 if (!($flags & CP_UID)) {
39 $messageNums = ImapHelpers::idToUid($imap, $messageNums);
40 }
41
42 $from = $imap->getMailboxName();
43 $to = $mailbox;
44
45 return $client->copy($messageNums, $from, $to);
46 }
47
48 /**
49 * Move specified messages to a mailbox.
50 *
51 * @param $imap
52 * @param $messageNums
53 * @param $mailbox
54 * @param $flags
55 *
56 * @return false|mixed
57 */
58 public static function move($imap, $messageNums, $mailbox, $flags = 0)
59 {
60 if (!is_a($imap, Connection::class)) {
61 return Errors::invalidImapConnection(debug_backtrace(), 1, false);
62 }
63
64 $client = $imap->getClient();
65 #$client->setDebug(true);
66
67 if (!($flags & CP_UID)) {
68 $messageNums = ImapHelpers::idToUid($imap, $messageNums);
69 }
70
71 return $client->move($messageNums, $imap->getMailboxName(), $mailbox);
72 }
73 }
74