Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
tool_messageinbound\manager Class Reference

Mail Pickup Manager. More...

Public Member Functions

 __construct ()
 Mail Pickup Manager.
 
 pickup_messages ()
 Execute the main Inbound Message pickup task.
 
 process_existing_message (stdClass $maildata,)
 Process a message received and validated by the Inbound Message processor.
 
 process_message (int $messageuid, bool $viewreadmessages=false, bool $skipsenderverification=false,)
 Process a message and pass it through the Inbound Message handling systems.
 
 tidy_old_messages ()
 Tidy up old messages in the confirmation folder.
 
 tidy_old_verification_failures ()
 Remove older verification failures.
 

Public Attributes

string const CONFIRMATIONFOLDER = 'tobeconfirmed'
 The mailbox to store messages in when they are awaiting confirmation.
 
string const MAILBOX = 'INBOX'
 The main mailbox to check.
 
string const MESSAGE_DELETED = '\deleted'
 The flag for deleted messages.
 
string const MESSAGE_FLAGGED = '\flagged'
 The flag for flagged messages.
 
string const MESSAGE_SEEN = '\seen'
 The flag for seen/read messages.
 

Protected Member Functions

 close_connection ()
 Shutdown and close the connection to the IMAP client.
 
 get_address_from_envelope (array $addresslist)
 Parse the address from the envelope.
 
 get_confirmation_folder ()
 Get the confirmation folder imap name.
 
 get_imap_client (string $mailbox=self::MAILBOX,)
 Retrieve the connection to the IMAP client.
 
 get_mailbox ()
 Get the current mailbox name.
 
 get_message_sequence_from_uid (int $messageuid,)
 Get the message sequence number from the message uid.
 
 load_dependencies ()
 We use Roundcube Framework to receive the emails.
 
 select_mailbox (string $mailbox,)
 Switch mailbox.
 

Protected Attributes

core message inbound address_manager $addressmanager = null
 A reference to the Inbound Message Address Manager instance.
 
rcube_imap_generic $client = null
 A reference to the IMAP client.
 
stdClass $currentmessagedata = null
 The data for the current message being processed.
 
string $imapnamespace = null
 IMAP folder namespace.
 

Detailed Description

Mail Pickup Manager.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_address_from_envelope()

tool_messageinbound\manager::get_address_from_envelope ( array $addresslist)
protected

Parse the address from the envelope.

Parameters
array$addresslistList of email addresses to parse.
Return values
array|nullList of parsed email addresses.

◆ get_confirmation_folder()

tool_messageinbound\manager::get_confirmation_folder ( )
protected

Get the confirmation folder imap name.

Return values
string

◆ get_imap_client()

tool_messageinbound\manager::get_imap_client ( string $mailbox = self::MAILBOX)
protected

Retrieve the connection to the IMAP client.

Parameters
string$mailboxThe mailbox to connect to.
Return values
boolWhether a connection was successfully established.

◆ get_mailbox()

tool_messageinbound\manager::get_mailbox ( )
protected

Get the current mailbox name.

Return values
stringThe current mailbox name.
Exceptions
core\message\inbound\processing_failed_exceptionif the mailbox could not be opened.

◆ get_message_sequence_from_uid()

tool_messageinbound\manager::get_message_sequence_from_uid ( int $messageuid)
protected

Get the message sequence number from the message uid.

Parameters
int$messageuidThe message uid to process.
Return values
intThe message sequence number.

◆ load_dependencies()

tool_messageinbound\manager::load_dependencies ( )
protected

We use Roundcube Framework to receive the emails.

This method will load the required dependencies.

◆ pickup_messages()

tool_messageinbound\manager::pickup_messages ( )

Execute the main Inbound Message pickup task.

Return values
bool

◆ process_existing_message()

tool_messageinbound\manager::process_existing_message ( stdClass $maildata)

Process a message received and validated by the Inbound Message processor.

Parameters
stdClass$maildataThe data retrieved from the database for the current record.
Return values
boolWhether the message was successfully processed.
Exceptions
core\message\inbound\processing_failed_exceptionif the message cannot be found.

◆ process_message()

tool_messageinbound\manager::process_message ( int $messageuid,
bool $viewreadmessages = false,
bool $skipsenderverification = false )

Process a message and pass it through the Inbound Message handling systems.

Parameters
int$messageuidThe message uid to process
bool$viewreadmessagesWhether to also look at messages which have been marked as read
bool$skipsenderverificationWhether to skip the sender verification stage

◆ select_mailbox()

tool_messageinbound\manager::select_mailbox ( string $mailbox)
protected

Switch mailbox.

Parameters
string$mailboxThe mailbox to switch to.

◆ tidy_old_messages()

tool_messageinbound\manager::tidy_old_messages ( )

Tidy up old messages in the confirmation folder.

Return values
boolWhether tidying occurred successfully.

◆ tidy_old_verification_failures()

tool_messageinbound\manager::tidy_old_verification_failures ( )

Remove older verification failures.

Return values
void

The documentation for this class was generated from the following file: