Mailer
in package
Class Mailer.
Table of Contents
- $config : array<string|int, mixed>
- $debugCollector : EmailCollector
- $lastResponse : string|null
- $logs : array<string|int, mixed>
- $socket : false|resource
- __construct() : mixed
- Mailer constructor.
- __destruct() : mixed
- Disconnect from SMTP server.
- createMessage() : Message
- Create a new Message instance.
- getConfig() : mixed
- Get a config value.
- getConfigs() : array<string, mixed>
- Get all configs.
- getLastResponse() : string|null
- Get the last response.
- getLogs() : array<int, array<string, mixed>>
- Get an array of logs.
- resetLogs() : static
- Reset logs.
- send() : bool
- Send an Email Message.
- setDebugCollector() : static
- Set the debug collector.
- addLog() : static
- authenticate() : bool
- connect() : bool
- disconnect() : bool
- getResponse() : string
- Get Mail Server response.
- makeConfig() : array<string, mixed>
- Make Base configurations.
- sendCommand() : int
- Send command to mail server.
- sendMessage() : false|int
- setLastResponse() : static
Properties
$config
protected
array<string|int, mixed>
$config
= []
$debugCollector
protected
EmailCollector
$debugCollector
$lastResponse
protected
string|null
$lastResponse
= null
$logs
protected
array<string|int, mixed>
$logs
= []
$socket
protected
false|resource
$socket
= false
Methods
__construct()
Mailer constructor.
public
__construct(array<string, mixed>|string $username[, string|null $password = null ][, string $host = 'localhost' ][, int $port = 587 ][, string|null $hostname = null ]) : mixed
Parameters
- $username : array<string, mixed>|string
- $password : string|null = null
- $host : string = 'localhost'
- $port : int = 587
- $hostname : string|null = null
Return values
mixed —__destruct()
Disconnect from SMTP server.
public
__destruct() : mixed
Return values
mixed —createMessage()
Create a new Message instance.
public
createMessage() : Message
Return values
Message —getConfig()
Get a config value.
public
getConfig(string $key) : mixed
Parameters
- $key : string
-
The config key
Return values
mixed —The config value
getConfigs()
Get all configs.
public
getConfigs() : array<string, mixed>
Return values
array<string, mixed> —getLastResponse()
Get the last response.
public
getLastResponse() : string|null
Return values
string|null —The last response or null if there is none
getLogs()
Get an array of logs.
public
getLogs() : array<int, array<string, mixed>>
Contains commands and responses from the Mailer server.
Return values
array<int, array<string, mixed>> —resetLogs()
Reset logs.
public
resetLogs() : static
Return values
static —send()
Send an Email Message.
public
send(Message $message) : bool
Parameters
- $message : Message
-
The Message instance
Return values
bool —True if successful, otherwise false
setDebugCollector()
Set the debug collector.
public
setDebugCollector(EmailCollector $collector) : static
Parameters
- $collector : EmailCollector
-
The debug collector
Return values
static —addLog()
protected
addLog(string $command, string $response) : static
Parameters
- $command : string
- $response : string
Return values
static —authenticate()
protected
authenticate() : bool
Tags
Return values
bool —connect()
protected
connect() : bool
Return values
bool —disconnect()
protected
disconnect() : bool
Return values
bool —getResponse()
Get Mail Server response.
protected
getResponse() : string
Return values
string —makeConfig()
Make Base configurations.
protected
makeConfig(array<string, mixed> $config) : array<string, mixed>
Parameters
- $config : array<string, mixed>
Return values
array<string, mixed> —sendCommand()
Send command to mail server.
protected
sendCommand(string $command) : int
Parameters
- $command : string
Return values
int —Response code
sendMessage()
protected
sendMessage(Message $message) : false|int
Parameters
- $message : Message
Return values
false|int —setLastResponse()
protected
setLastResponse(string|null $lastResponse) : static
Parameters
- $lastResponse : string|null