-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathclass-post-by-email-mailserver.php
122 lines (111 loc) · 2.36 KB
/
class-post-by-email-mailserver.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
<?php
/**
* Post By Email
*
* @package PostByEmail
* @author Kat Hagan <[email protected]>
* @license GPL-2.0+
* @link https://github.com/codebykat/wp-post-by-email/
* @copyright 2013-2015 Kat Hagan / Automattic
*/
/**
* Abstract Mailserver class.
*
* @package PostByEmail
* @author Kat Hagan <[email protected]>
*/
abstract class Post_By_Email_Mailserver {
/**
* Active connection.
*
* @since 1.1
*
* @var object
*/
protected $connection;
/**
* Connection protocol (POP3 or IMAP).
*
* @since 1.1
*
* @var string
*/
protected $protocol;
/**
* Establishes the connection to the mailserver.
*
* @since 1.1
*
* @param array $options Options array
*
* @return object
*/
abstract public function open_mailbox_connection( $connection_options );
/**
* Closes the connection to the mailserver.
*
* @since 1.1
*/
abstract public function close_connection();
/**
* Retrieve the list of new message IDs from the server.
*
* @since 1.1
*
* @return array Array of message UIDs
* @throws Horde_Imap_Client_Exception
*/
abstract public function get_messages();
/**
* Retrieve message headers.
*
* @since 1.1
*
* @param int $uid Message UID
*
* @return object
*/
abstract public function get_message_headers( $id );
/**
* Mark a list of messages read on the server.
*
* @since 1.1
*
* @param array $uids UIDs of messages to mark read
* @param bool $delete Whether to delete read messages
*
* @throws Horde_Imap_Client_Exception
*/
abstract public function mark_as_read( $uids, $delete=false );
/**
* Get the content of a message from the mailserver.
*
* @since 1.1
*
* @param int Message UID
*
* @return string Message content
*/
abstract public function get_message_body( $uid );
/**
* Get a message's attachments from the mail server.
*
* @since 1.1
*
* @param int Message UID
*
* @return array Attachments
*/
abstract public function get_attachments( $uid );
/**
* Get a single attachment from the mail server.
*
* @since 1.1
*
* @param int Message UID
* @param int Attachment's MIME ID
*
* @return string Decoded attachment data
*/
abstract public function get_single_attachment( $uid, $mime_id );
}