Moodle PHP Documentation 4.4
Moodle 4.4.9+ (Build: 20250706) (82fb415b695)
core\test\mailpit_message Class Reference
Inheritance diagram for core\test\mailpit_message:
core\test\message

Public Member Functions

 get_bcc ()
 Get the message bcc recipients.
 
 get_body_html ()
 Get the HTML representation of the body, if one was provided.
 
 get_body_text ()
 Get the text representation of the body, if one was provided.
 
 get_cc ()
 Get the message cc recipients.
 
 get_first_recipient ()
 Get the first recipient of the message.
 
 get_id ()
 Get the message ID.
 
 get_recipients ()
 Get the message recipients.
 
 get_sender ()
 Get the message sender.
 
 get_subject ()
 Get the message subject.
 
 has_recipient (string $email)
 Whether the message has the specified recipient.
 

Static Public Member Functions

static create_from_api_response (email_catcher $client, stdClass $message, bool $showdetails=false,)
 Create a message from an api response.
 

Protected Member Functions

 __construct (private email_catcher readonly email_catcher $client, private string readonly string $id, private stdClass readonly stdClass $sender, private string readonly string $subject, private array readonly array $recipients, private array readonly array $cc=[], private array readonly array $bcc=[], private int readonly int $attachmentcount=0, private ?string ?string $text=null, private ?string ?string $html=null, private array array $attachments=[], private array array $inline=[],)
 Constructor.
 
 load_message_content ()
 Load the message content.
 

Protected Attributes

bool bool $messageloaded = false
 Whether the message has been loaded.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

core\test\mailpit_message::__construct ( private email_catcher readonly email_catcher $client,
private string readonly string $id,
private stdClass readonly stdClass $sender,
private string readonly string $subject,
private array readonly array $recipients,
private array readonly array $cc = [],
private array readonly array $bcc = [],
private int readonly int $attachmentcount = 0,
private ?string ?string $text = null,
private ?string ?string $html = null,
private array array $attachments = [],
private array array $inline = [] )
protected

Constructor.

Parameters
email_catcher$clientThe email catcher client.
string$idThe message ID.
stdClass$senderThe sender.
string$subjectThe subject.
array$recipientsThe recipients.
array$ccThe cc recipients.
array$bccThe bcc recipients.
int$attachmentcountThe number of attachments.
string | null$textThe text body.
string | null$htmlThe HTML body.
array$attachmentsThe attachments.
array$inlineThe inline attachments.
Parameters
$client$client The email catcher client used for message operations.
$id$id The unique identifier for the message.
$sender$sender The sender of the message, represented as an object with email details.
$subject$subject The subject line of the message.
$recipients$recipients List of primary recipients for the message.
$cc$cc List of carbon copy recipients (optional, defaults to an empty array).
$bcc$bcc List of blind carbon copy recipients (optional, defaults to an empty array).
$attachmentcount$attachmentcount The number of attachments in the message (default is 0).
$text$text The plain text body of the message (nullable, might be loaded later).
$html$html The HTML body of the message (nullable, might be loaded later).
$attachments$attachments An array of attachment details (defaults to empty array).
$inline$inline An array of inline elements like images or styles (defaults to empty array).

Member Function Documentation

◆ create_from_api_response()

static core\test\mailpit_message::create_from_api_response ( email_catcher $client,
stdClass $message,
bool $showdetails = false )
static

Create a message from an api response.

Parameters
email_catcher$clientThe email catcher client.
stdClass$messageThe api response.
bool$showdetailsOptional. Whether to include detailed information in the messages. Default is false.
Return values
mailpit_messageThe created mailpit message instance.

◆ get_bcc()

core\test\mailpit_message::get_bcc ( )

Get the message bcc recipients.

Return values
iterableThe bcc recipients.

Implements core\test\message.

◆ get_body_html()

core\test\mailpit_message::get_body_html ( )

Get the HTML representation of the body, if one was provided.

Return values
null|stringThe HTML body.

Implements core\test\message.

◆ get_body_text()

core\test\mailpit_message::get_body_text ( )

Get the text representation of the body, if one was provided.

Return values
null|stringThe text body.

Implements core\test\message.

◆ get_cc()

core\test\mailpit_message::get_cc ( )

Get the message cc recipients.

Return values
iterableThe cc recipients.

Implements core\test\message.

◆ get_first_recipient()

core\test\mailpit_message::get_first_recipient ( )

Get the first recipient of the message.

Return values
stringThe email address of the first recipient.

◆ get_id()

core\test\mailpit_message::get_id ( )

Get the message ID.

Return values
stringThe ID.

◆ get_recipients()

core\test\mailpit_message::get_recipients ( )

Get the message recipients.

Return values
iterableThe recipients.

Implements core\test\message.

◆ get_sender()

core\test\mailpit_message::get_sender ( )

Get the message sender.

Return values
message_userThe sender.

Implements core\test\message.

◆ get_subject()

core\test\mailpit_message::get_subject ( )

Get the message subject.

Return values
stringThe subject.

Implements core\test\message.

◆ has_recipient()

core\test\mailpit_message::has_recipient ( string $email)

Whether the message has the specified recipient.

Parameters
string$emailThe email address.
Return values
boolWhether the message has the recipient.

Implements core\test\message.


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