pclib
3.2.0
Lightweight PHP framework
|
Creating, sending, logging, scheduling e-mail messages. More...
Public Member Functions | |
__construct (array $options=[]) | |
Create mailer service. More... | |
send ($id, array $data=[], array $mailFields=[]) | |
Send email using template $id. More... | |
create ($id, array $data=[], array $mailFields=[]) | |
Create mail message from template $id. More... | |
schedule ($id, array $data=[], array $mailFields=[]) | |
Create and save message to be sent later. More... | |
dispatch ($n=null) | |
Dispatch (send) scheduled messages. More... | |
save ($message) | |
Save message into database. More... | |
load ($id) | |
Load mail message from database. More... | |
setLayout ($path) | |
Set template layout used by all messages. More... | |
setDeveloperOnlyMode ($email) | |
When enabled, all messages (preview) are sent not to real address, but to developer $email. More... | |
![]() | |
loadDefaults ($className=null) | |
Load default parameters of class $className into object instance. | |
setProperties (array $defaults) | |
Set public properties of object from the array. More... | |
toArray () | |
Convert object to array. More... | |
Data Fields | |
$sender | |
Mailer driver used for actual sending emails. | |
$db | |
var Db | |
$layout | |
Layout template. More... | |
![]() | |
$serviceLocator | |
var function() Return service object when requested with service(). | |
Protected Member Functions | |
template ($id, array $data) | |
Create and return mail template. More... | |
clearMessages () | |
Remove submitted messages older than 'keep_days' from database. | |
![]() | |
service ($service, $default=null) | |
Try acquire $service and load it into property $this->$service. More... | |
Protected Attributes | |
$app | |
var App | |
$options | |
Mailer configuration. | |
Additional Inherited Members | |
![]() | |
static | defaults () |
Set or retireve default parameters of the object. More... | |
Creating, sending, logging, scheduling e-mail messages.
Requires PHPMailer library for sending e-mails.
__construct | ( | array | $options = [] | ) |
Create mailer service.
$options | Mailer configuration - see setOptions() for configuration keys. |
create | ( | $id, | |
array | $data = [] , |
||
array | $mailFields = [] |
||
) |
Create mail message from template $id.
string | $id | Template path or database id |
array | $data | Template values |
array | $mailFields | Mail fields (from, to, cc, bcc, subject, replyTo) |
dispatch | ( | $n = null | ) |
Dispatch (send) scheduled messages.
int | $n | Send max $n messages in this run |
load | ( | $id | ) |
save | ( | $message | ) |
schedule | ( | $id, | |
array | $data = [] , |
||
array | $mailFields = [] |
||
) |
Create and save message to be sent later.
string | $id | Template path or database id |
array | $data | Template values |
array | $mailFields | Mail fields (from, to, cc, bcc, subject, replyTo) |
send | ( | $id, | |
array | $data = [] , |
||
array | $mailFields = [] |
||
) |
Send email using template $id.
You can use also with MailMessage class: $mailer->send($message);
string | $id | Template path or database id |
array | $data | Template values |
array | $mailFields | Mail fields (from, to, cc, bcc, subject, replyTo) |
setDeveloperOnlyMode | ( | ) |
When enabled, all messages (preview) are sent not to real address, but to developer $email.
You can set this by config parameter 'developer_only_mode_email' too.
string |
setLayout | ( | $path | ) |
Set template layout used by all messages.
It works same way as application layout. You can set this by config parameter 'layout' too.
string | $path | Path to template. |
|
protected |
Create and return mail template.
string | $id | Template path or database id |
array | $data | Template values |
$layout |
Layout template.