3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Class CRM_Mailing_MailStore_Pop3
21 class CRM_Mailing_MailStore_Pop3
extends CRM_Mailing_MailStore
{
24 * Connect to the supplied POP3 server and make sure the two mail dirs exist
28 * @param string $username
29 * Authentication username.
30 * @param string $password
31 * Authentication password.
33 * Whether to use POP3 or POP3S.
35 * @return \CRM_Mailing_MailStore_Pop3
37 public function __construct($host, $username, $password, $ssl = TRUE) {
39 print "connecting to $host and authenticating as $username\n";
42 $options = ['ssl' => $ssl];
43 $this->_transport
= new ezcMailPop3Transport($host, NULL, $options);
44 $this->_transport
->authenticate($username, $password);
46 $this->_ignored
= $this->maildir(implode(DIRECTORY_SEPARATOR
, [
52 $this->_processed
= $this->maildir(implode(DIRECTORY_SEPARATOR
, [
61 * Fetch the specified message to the local ignore folder.
64 * Number of the message to fetch.
66 public function markIgnored($nr) {
68 print "fetching message $nr and putting it in the ignored mailbox\n";
70 $set = new ezcMailStorageSet($this->_transport
->fetchByMessageNr($nr), $this->_ignored
);
71 $parser = new ezcMailParser();
72 $parser->parseMail($set);
73 $this->_transport
->delete($nr);
77 * Fetch the specified message to the local processed folder.
80 * Number of the message to fetch.
82 public function markProcessed($nr) {
84 print "fetching message $nr and putting it in the processed mailbox\n";
86 $set = new ezcMailStorageSet($this->_transport
->fetchByMessageNr($nr), $this->_processed
);
87 $parser = new ezcMailParser();
88 $parser->parseMail($set);
89 $this->_transport
->delete($nr);