MailAgent
in package
Table of Contents
Constants
- APIS_DEFAULT = 'SendMail'
- APIS_FOLDER = __DIR__ . '/APIs'
- APIS_NAMESPACE = __NAMESPACE__ . '\APIs\\'
Properties
- $agent : string
- $loaded_api : MailAgentInterface|bool
- $min_smf_version : string
- $version_compatible : string
Methods
- agentSettings() : void
- Specify custom settings that the agent supports.
- connect() : bool
- Connects to the mail agent. Not all agents will need to connect.
- detect() : array<string|int, MailAgentInterface>
- Get the installed Mail Agent implementations.
- disconnect() : bool
- Disconnects to the mail agent. Not all agents will need to disconnect.
- getImplementationClassKeyName() : string
- Gets the class identifier of the current agent implementation.
- getMinimumVersion() : string
- Gets the min version that we support.
- getVersion() : string
- Gets the Version of the Caching API.
- isCompatible() : string
- Is our SMF version supported with this Agent.
- isConfigured() : bool
- Checks if the agent has been configured for usage.
- isSupported() : bool
- Checks if the requirements for the agent are available.
- load() : MailAgentInterface|false
- Try to load up a supported agent method.
- send() : bool
- Sends the email via the agent
Constants
APIS_DEFAULT
public
string
APIS_DEFAULT
= 'SendMail'
Default Agent to use or to fallback to if the agent selected is not supported or configured correctly.
APIS_FOLDER
public
string
APIS_FOLDER
= __DIR__ . '/APIs'
The directory containing our Agents we can use.
APIS_NAMESPACE
public
string
APIS_NAMESPACE
= __NAMESPACE__ . '\APIs\\'
The root namespace used by all our Agents.
Properties
$agent
public
static string
$agent
Name of the selected agent.
This is an copy of the $modSettings['mail_type'].
$loaded_api
public
static MailAgentInterface|bool
$loaded_api
The loaded agent, or false on failure.
$min_smf_version
protected
string
$min_smf_version
= '3.0 Alpha 1'
The minimum SMF version that this will work with.
$version_compatible
protected
string
$version_compatible
= '3.0.999'
The maximum SMF version that this will work with.
Methods
agentSettings()
Specify custom settings that the agent supports.
public
agentSettings(array<string|int, mixed> &$config_vars) : void
Parameters
- $config_vars : array<string|int, mixed>
-
Additional config_vars, see ManageSettings.php for usage.
connect()
Connects to the mail agent. Not all agents will need to connect.
public
connect() : bool
Return values
bool —Whether or not the agent method was connected to.
detect()
Get the installed Mail Agent implementations.
public
final static detect() : array<string|int, MailAgentInterface>
Return values
array<string|int, MailAgentInterface> —An array of mail agents
disconnect()
Disconnects to the mail agent. Not all agents will need to disconnect.
public
disconnect() : bool
Return values
bool —Whether or not the agent method was connected to.
getImplementationClassKeyName()
Gets the class identifier of the current agent implementation.
public
getImplementationClassKeyName() : string
Return values
string —the unique identifier for the current class implementation.
getMinimumVersion()
Gets the min version that we support.
public
getMinimumVersion() : string
Return values
string —the value of $key.
getVersion()
Gets the Version of the Caching API.
public
getVersion() : string
Return values
string —the value of $key.
isCompatible()
Is our SMF version supported with this Agent.
public
isCompatible(string $smfVersion) : string
Parameters
- $smfVersion : string
Return values
string —the value of $key.
isConfigured()
Checks if the agent has been configured for usage.
public
isConfigured() : bool
Return values
bool —True if the agent is configured, false otherwise.
isSupported()
Checks if the requirements for the agent are available.
public
isSupported() : bool
Return values
bool —True if the agent is supported, false otherwise.
load()
Try to load up a supported agent method.
public
final static load([bool $loadDefault = false ]) : MailAgentInterface|false
This is saved in $loaded_api if we are not overriding it.
Parameters
- $loadDefault : bool = false
-
Use the default SMF method if the selected agent fails.
Tags
Return values
MailAgentInterface|false —An instance of a child class of this class, or false on failure.
send()
Sends the email via the agent
public
send(string $to, string $subject, string $message, array<string|int, mixed> $headers) : bool
Parameters
- $to : string
- $subject : string
- $message : string
-
Message should be formatted with html/plain text.
- $headers : array<string|int, mixed>
-
Any additional headers.