Mailer
in package
implements
MailerInterface
Uses
LoggerTrait
Send emails
Table of Contents
Interfaces
- MailerInterface
- Mail interface
Constants
- LOG_ERROR_MESSAGE = 'Error send email.'
- LOG_INFO_MESSAGE = 'Email send successful.'
Properties
- $logger : LoggerInterface|null
- Logger ref
- $driverName : string|null
- Driver name
- $error : string|null
- Mailer error message
- $mailer : Mailer
- Mailer object
- $options : array<string|int, mixed>
- Options
- $view : EmailViewInterface|null
- Email component renderer
Methods
- __construct() : mixed
- Constructor
- crateSendmailTranspart() : object
- Create sendmail transport
- create() : MailInterface|null
- Create message
- getErrorMessage() : string|null
- Get error message
- getFromEmail() : string
- Get from email option
- getFromName() : string
- Get from name option
- getLogger() : LoggerInterface|null
- Get logger
- getOption() : mixed
- Get option value
- getOptions() : array<string|int, mixed>
- Return options
- getTransport() : Transport
- Get mailer transport
- LogError() : bool
- Log error message
- Loginfo() : bool
- Log info messsage
- send() : bool
- Send email
- setLogger() : void
- Set logger
Constants
LOG_ERROR_MESSAGE
public
mixed
LOG_ERROR_MESSAGE
= 'Error send email.'
LOG_INFO_MESSAGE
public
mixed
LOG_INFO_MESSAGE
= 'Email send successful.'
Properties
$logger
Logger ref
protected
LoggerInterface|null
$logger
= null
$driverName
Driver name
private
string|null
$driverName
= 'sendmail'
$error
Mailer error message
private
string|null
$error
= null
$mailer
Mailer object
private
Mailer
$mailer
$options
Options
private
array<string|int, mixed>
$options
= []
$view
Email component renderer
private
EmailViewInterface|null
$view
Methods
__construct()
Constructor
public
__construct(array<string|int, mixed> $options, EmailViewInterface $view[, MailerDriverInterface|null $driver = null ][, LoggerInterface|null $logger = null ]) : mixed
Parameters
- $options : array<string|int, mixed>
- $view : EmailViewInterface
- $driver : MailerDriverInterface|null = null
- $logger : LoggerInterface|null = null
crateSendmailTranspart()
Create sendmail transport
public
static crateSendmailTranspart() : object
Return values
objectcreate()
Create message
public
create([string|null $componentName = null ][, array<string|int, mixed> $params = [] ][, string|null $language = null ]) : MailInterface|null
Parameters
- $componentName : string|null = null
- $params : array<string|int, mixed> = []
- $language : string|null = null
Return values
MailInterface|nullgetErrorMessage()
Get error message
public
getErrorMessage() : string|null
Return values
string|nullgetFromEmail()
Get from email option
public
getFromEmail() : string
Return values
stringgetFromName()
Get from name option
public
getFromName() : string
Return values
stringgetLogger()
Get logger
public
getLogger() : LoggerInterface|null
Return values
LoggerInterface|nullgetOption()
Get option value
public
getOption(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
getOptions()
Return options
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getTransport()
Get mailer transport
public
getTransport() : Transport
Return values
TransportLogError()
Log error message
public
LogError(string $message[, array<string|int, mixed> $context = [] ]) : bool
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
boolLoginfo()
Log info messsage
public
Loginfo(string $message[, array<string|int, mixed> $context = [] ]) : bool
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
boolsend()
Send email
public
send(MailInterface $message) : bool
Parameters
- $message : MailInterface
Return values
boolsetLogger()
Set logger
public
setLogger(LoggerInterface|null $logger) : void
Parameters
- $logger : LoggerInterface|null