Files
server/shared/lib/Mail/Object/MessagePropertiesBaseInterface.php
Sebastian Krupinski f3c882454d
All checks were successful
Build Test / build (pull_request) Successful in 12s
JS Unit Tests / test (pull_request) Successful in 11s
PHP Unit Tests / test (pull_request) Successful in 39s
refactor: mail interfaces
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-05-14 22:54:51 -04:00

245 lines
5.5 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Mail\Object;
use DateTimeImmutable;
use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
/**
* Message Properties Base Interface
*
* @since 2025.05.01
*/
interface MessagePropertiesBaseInterface extends NodePropertiesBaseInterface {
public const PROPERTY_SIZE = 'size';
public const PROPERTY_HEADERS = 'headers';
public const PROPERTY_URID = 'urid'; // mime message ID or similar unique identifier
public const PROPERTY_IN_REPLY_TO = 'inReplyTo';
public const PROPERTY_REFERENCES = 'references';
public const PROPERTY_RECEIVED = 'received';
public const PROPERTY_SENT = 'sent';
public const PROPERTY_SENDER = 'sender';
public const PROPERTY_REPLY_TO = 'replyTo';
public const PROPERTY_FROM = 'from';
public const PROPERTY_TO = 'to';
public const PROPERTY_CC = 'cc';
public const PROPERTY_BCC = 'bcc';
public const PROPERTY_SUBJECT = 'subject';
public const PROPERTY_BODY = 'body';
public const PROPERTY_BODY_TEXT_PLAIN = 'bodyTextPlain';
public const PROPERTY_BODY_TEXT_HTML = 'bodyTextHtml';
public const PROPERTY_ATTACHMENTS = 'attachments';
public const PROPERTY_FLAGS = 'flags';
public const PROPERTY_TAGS = 'tags';
/**
* Gets the message size in bytes
*
* @since 2025.05.01
*
* @return int|null
*/
public function getSize(): ?int;
/**
* Gets custom headers
*
* @since 2025.05.01
*
* @return array<string,string> Header name => value
*/
public function getHeaders(): array;
/**
* Gets a specific header value
*
* @since 2025.05.01
*
* @param string $name Header name
*
* @return string|array<int,string>|null Header value(s) or null if not set
*/
public function getHeader(string $name): string|array|null;
/**
* Gets the universal resource identifier (URN)
*
* @since 2025.05.01
*
* @return string|null
*/
public function getUrid(): ?string;
/**
* Gets the message ID this is replying to
*
* @since 2025.05.01
*
* @return string|null
*/
public function getInReplyTo(): ?string;
/**
* Gets the references (message IDs in thread)
*
* @since 2025.05.01
*
* @return array<int,string>
*/
public function getReferences(): array;
/**
* Gets the received date
*
* @since 2025.05.01
*
* @return DateTimeImmutable|null
*/
public function getReceived(): ?DateTimeImmutable;
/**
* Gets the sent date
*
* @since 2025.05.01
*
* @return DateTimeImmutable|null
*/
public function getSent(): ?DateTimeImmutable;
/**
* Gets the sender address (actual sender, may differ from From)
*
* @since 2025.05.01
*
* @return AddressInterface|null
*/
public function getSender(): ?AddressInterface;
/**
* Gets the sender address
*
* @since 2025.05.01
*
* @return AddressInterface|null
*/
public function getFrom(): ?AddressInterface;
/**
* Gets the reply-to addresses
*
* @since 2025.05.01
*
* @return array<int,AddressInterface>
*/
public function getReplyTo(): array;
/**
* Gets the primary recipients (To)
*
* @since 2025.05.01
*
* @return array<int,AddressInterface>
*/
public function getTo(): array;
/**
* Gets the carbon copy recipients (CC)
*
* @since 2025.05.01
*
* @return array<int,AddressInterface>
*/
public function getCc(): array;
/**
* Gets the blind carbon copy recipients (BCC)
*
* @since 2025.05.01
*
* @return array<int,AddressInterface>
*/
public function getBcc(): array;
/**
* Gets the message subject
*
* @since 2025.05.01
*
* @return string
*/
public function getSubject(): string;
/**
* Gets the message body structure
*
* @since 2025.05.01
*
* @return MessagePartInterface|null The body structure or null if no body
*/
public function getBody(): ?MessagePartInterface;
/**
* Checks if the message has any body content
*
* @since 2025.05.01
*
* @return bool True if text or HTML body is set
*/
public function hasBody(): bool;
/**
* Gets the plain text body content
*
* @since 2025.05.01
*
* @return string|null
*/
public function getBodyTextPlain(): ?string;
/**
* Gets the HTML body content
*
* @since 2025.05.01
*
* @return string|null
*/
public function getBodyTextHtml(): ?string;
/**
* Gets the attachments
*
* @since 2025.05.01
*
* @return array<int,AttachmentInterface>
*/
public function getAttachments(): array;
/**
* Gets message flags
*
* @since 2025.05.01
*
* @return array{read:bool,starred:bool,important:bool,answered:bool,forwarded:bool,draft:bool,deleted:bool,flagged:bool}
*/
public function getFlags(): array;
/**
* Gets a specific flag value
*
* @since 2025.05.01
*
* @param string $name Flag name (read, starred, important, answered, forwarded, draft, deleted, flagged)
*
* @return bool
*/
public function getFlag(string $name): bool;
}