\CGExtensions\EmailEmail

Defines an immutable object representing a templatable email, what is attached to it, and who it is going to be sent to in the context of CMSMS.

Summary

Methods
Properties
Constants
has_addresses()
get_email_name()
clear_addresses()
with_subject_template()
with_body_template()
add_data()
add_attachment()
add_admin_group()
add_feu_uid()
add_feu_group()
with_priority()
with_encode_subject()
with_current_admin()
with_current_feu()
add_address()
add_cc()
add_bcc()
$to_admin_groups
$to_feu_users
$to_feu_groups
$to_current_admin
$to_current_feu
$to_addr
$cc_addr
$bcc_addr
$data
$attachments
$subj_tpl
$body_tpl
$priority
$encode_subject
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$to_admin_groups

$to_admin_groups : array<mixed,string>

A list of admin group names or ids that this message should be sent to.

Type

array<mixed,string>

$to_feu_users

$to_feu_users : array<mixed,integer>

A list of FEU user ids that this message should be sent to.

Type

array<mixed,integer>

$to_feu_groups

$to_feu_groups : array<mixed,string>

A list of FEU user group names or ids that this message should be sent to.

Type

array<mixed,string>

$to_current_admin

$to_current_admin : boolean

Indicates whether this message should be sent to the current logged in administrator (admin requests only)

Type

boolean

$to_current_feu

$to_current_feu : boolean

Indicates whether this message should be sent to the current logged in FEU user (frontend requests only)

Type

boolean

$to_addr

$to_addr : array<mixed,string>

Additional email addresses to send this message to

Type

array<mixed,string>

$cc_addr

$cc_addr : array<mixed,string>

A list of email addresses to CC this message to.

Type

array<mixed,string>

$bcc_addr

$bcc_addr : array<mixed,string>

A list of email addresses to BCC this message to.

Type

array<mixed,string>

$data

$data : array

An associative array of variables and values to assign to smarty when processing the template(s).

Type

array

$attachments

$attachments : array<mixed,string>

An optional list of file attachments

Type

array<mixed,string>

$subj_tpl

$subj_tpl : string

The smarty template for the email subject.

Type

string

$body_tpl

$body_tpl : string

The smarty template for the email body

Type

string

$priority

$priority : integer

A priority value between 1 and 5 where 1 is high priority, and 5 is low. Default is 3

Type

integer

$encode_subject

$encode_subject : boolean

Enable base64 encoding of subject to allow extended characters (but not HTML entities). Default is false

Type

boolean

Methods

has_addresses()

has_addresses() : boolean

Test if this email object has some addresses defined.

Note: does not test if the addresses are duplicate or valid.

Returns

boolean

get_email_name()

get_email_name(string  $addr) : string|null

Get an email name (if any) for an address.

Parameters

string $addr

an email address

Returns

string|null

clear_addresses()

clear_addresses() : \CGExtensions\Email\Email

Clear all known addresses.

Returns

\CGExtensions\Email\Email

with_subject_template()

with_subject_template(string  $tpl) : \CGExtensions\Email\Email

Adjust the subject template

Parameters

string $tpl

The smarty template used to generate the email subject.

Returns

\CGExtensions\Email\Email

with_body_template()

with_body_template(string  $tpl) : \CGExtensions\Email\Email

Adjust the body template

Parameters

string $tpl

The smarty template used to generate the email body. Cannot be empty.

Returns

\CGExtensions\Email\Email

add_data()

add_data(string  $key, mixed  $val) : \CGExtensions\Email\Email

Add a key and value to the data

Parameters

string $key
mixed $val

Returns

\CGExtensions\Email\Email

add_attachment()

add_attachment(string  $filename) : \CGExtensions\Email\Email

Add an attachment

Parameters

string $filename

A complete path name

Returns

\CGExtensions\Email\Email

add_admin_group()

add_admin_group(  $gid) : \CGExtensions\Email\Email

Add an admin group to the list of groups to send to.

Parameters

$gid

Returns

\CGExtensions\Email\Email

add_feu_uid()

add_feu_uid(integer  $uid) : \CGExtensions\Email\Email

Add an FEU uid to the list of individual FEU users to send to.

Note, must be a valid uid. The system will not check if this is a disabled or expired user.

Parameters

integer $uid

A valid FEU user id

Returns

\CGExtensions\Email\Email

add_feu_group()

add_feu_group(string|integer  $gid) : \CGExtensions\Email\Email

Add an FEU group to the list of groups to send to.

Parameters

string|integer $gid

An FEU group id or name.

Returns

\CGExtensions\Email\Email

with_priority()

with_priority(integer  $val) : \CGExtensions\Email\Email

Adjust the priority of the message

Parameters

integer $val

A number between 1 and 5

Returns

\CGExtensions\Email\Email

with_encode_subject()

with_encode_subject(boolean  $flag) : \CGExtensions\Email\Email

Adjust the encode subject flag.

Parameters

boolean $flag

Returns

\CGExtensions\Email\Email

with_current_admin()

with_current_admin(boolean  $flag) : \CGExtensions\Email\Email

Adjust the current_admin flag to indicate whether or not this email should be sent to the currently logged in admin

Parameters

boolean $flag

Returns

\CGExtensions\Email\Email

with_current_feu()

with_current_feu(boolean  $flag) : \CGExtensions\Email\Email

Adjust the flag indicating whether or not this email should be sent to the currently logged in FEU user for FEU requests

Parameters

boolean $flag

Returns

\CGExtensions\Email\Email

add_address()

add_address(string  $addr, string  $name = null) : \CGExtensions\Email\Email

Add an additional email address to send this message to.

Parameters

string $addr
string $name

An optional text name

Returns

\CGExtensions\Email\Email

add_cc()

add_cc(string  $addr, string  $name = null) : \CGExtensions\Email\Email

Add an email address to the CC list

Parameters

string $addr
string $name

An optional text name

Returns

\CGExtensions\Email\Email

add_bcc()

add_bcc(string  $addr, string  $name = null) : \CGExtensions\Email\Email

Add an email address to the BCC list

Parameters

string $addr
string $name

An optional text name

Returns

\CGExtensions\Email\Email