| 
				 public 
				
				
				 | 
			#
			__construct( )
				
Initialize Emails Overrides | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			get( integer $id )
				
Retrieves a single email template by ID, including email group tags 
				
Retrieves a single email template by ID, including email group tags Parameters
						$idinteger$id The ID of the email template to fetch
Returns
						mixedA stdClass object representing the email template, false if no such template
exists
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getByGroupId( integer $group_id, string $lang = null )
				
Retrieves a signle email template by Group ID for the current company 
				
Retrieves a signle email template by Group ID for the current company Parameters
						$group_idinteger$group_id The email group ID to use to fetch the email tempalte for the current
company
$langstring$lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
(optional, defaults to default language)
Returns
						mixedA stdClass object representing the email template, false if no such template
exists
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getByType( integer $company_id, string $action, string $lang = null )
				
Fetches a single email template by company ID, type, and (optionally)
language 
				
Fetches a single email template by company ID, type, and (optionally)
language Parameters
						$company_idinteger$company_id The ID of the company to fetch the email for
$actionstring$action The email group action to fetch
$langstring$lang The language of template to fetch, defaults to default language
Returns
						mixedA stdClass object representing the email template, false if no such template
exists
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getList( integer $company_id, string $email_group_id )
				
Fetches a list of all email templates under a company for the given email
group in every available language 
				
Fetches a list of all email templates under a company for the given email
group in every available language Parameters
						$company_idinteger$company_id The company ID to fetch email templates for
$email_group_idstring$email_group_id The email group ID
Returns
						mixedAn array of objects or false if no results.
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			add( array $vars )
				
Adds an email with the given data 
				
Adds an email with the given data Parameters
						$varsarray$vars An array of email info including: - email_group_id The ID of the group
this email belongs to - company_id The company ID this email belongs to - lang
The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
(optional, default en_us) - from The address the message will be sent from -
from_name The name belonging to the from address - subject The subject of the
message - text The plain-text body of the message (if empty will be created
based on the html content) (optional, default null) - html The html body of the
message (optional, default null) - email_signature_id The signature to append to
the email (optional, default null) - include_attachments 1 to include
attachments when the email is sent, 0 to not send attachments with the email
(optional, default 1) - status The status of this email 'active', 'inactive'
(optional, default active)
Returns
						integerThe ID of the email, void on error
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			edit( integer $id, array $vars )
				
Updates the email with the given data 
				
Updates the email with the given data Parameters
						$idinteger$id The ID of the email to update
$varsarray$vars An array of email info including: - email_group_id The ID of the group
this email belongs to - company_id The company ID this email belongs to - lang
The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
(optional, default en_us) - from The address the message will be sent from -
from_name The name belonging to the from address - subject The subject of the
message - text The plain-text body of the message (if empty will be created
based on the html content) (optional, default null) - html The html body of the
message (optional, default null) - email_signature_id The signature to append to
the email (optional, default null) - include_attachments 1 to include
attachments when the email is sent, 0 to not send attachments with the email
(optional) - status The status of this email 'active', 'inactive' (optional,
default active)
 | 
		
			| 
				 public 
				
				
				 | 
			#
			delete( integer $id )
				
Permanently removes the email from the system. 
				
Permanently removes the email from the system. Parameters
						$idinteger$id The ID of the email to delete
 | 
		
			| 
				 public 
				
				
				 | 
			#
			deleteAll( integer $email_group_id, integer $company_id )
				
Permanently removes all email templates of the given group from the
system. 
				
Permanently removes all email templates of the given group from the
system. Parameters
						$email_group_idinteger$email_group_id The ID of the email group to remove all email template from
$company_idinteger$company_id The ID of the company to remove all email templates in this group
 | 
		
			| 
				 public 
				
				
				 | 
			#
			updateFromDomain( string $domain, integer $company_id )
				
Updates the domani portion of the from name for every email in the given
company. 
				
Updates the domani portion of the from name for every email in the given
company. Parameters
						$domainstring$domain The new domain to use
$company_idinteger$company_id The ID of the company to update
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getStatusTypes( )
				
Retrieves a list of email status types 
				
Retrieves a list of email status types Returns
						arrayKey=>value pairs of email status types
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			addSignature( array $vars )
				
Adds the given signature to the system 
				
Adds the given signature to the system Parameters
						$varsarray$vars An array of signature info including: - company_id The company ID to
create the signature under - name The name of the signature - text The plaintext
signature - html The HTML signature
 | 
		
			| 
				 public 
				
				
				 | 
			#
			editSignature( mixed $email_signature_id, array $vars )
				
Updates an existing signature in the system 
				
Updates an existing signature in the system Parameters
						$email_signature_idmixed$email_signature_id The ID of the signature in the system to update
$varsarray$vars An array of signature info including: - name The name of the signature -
text The plaintext signature - html The HTML signature
 | 
		
			| 
				 public 
				
				
				 | 
			#
			deleteSignature( integer $email_signature_id )
				
Permanently removes an email signature from the system 
				
Permanently removes an email signature from the system Parameters
						$email_signature_idinteger$email_signature_id The ID of the email signature to delete
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getSignature( integer $email_signature_id )
				
Fetches an email signature 
				
Fetches an email signature Parameters
						$email_signature_idinteger$email_signature_id The email signature ID
Returns
						mixedAn array of objects or false if no results.
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getSignatureList( integer $company_id, integer $page = 1, string $order_by = array('name'=>"ASC") )
				
Fetches a list of all email signatures for a given company 
				
Fetches a list of all email signatures for a given company Parameters
						$company_idinteger$company_id The company ID whose signatures to fetch
$pageinteger$page The page to return results for (optional, default 1)
$order_bystring$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"),
optional)
Returns
						arrayAn array of objects or false if no results.
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getSignatureListCount( integer $company_id )
				
Fetches the total number of signatures returned from
Emails::getSignatureList(), useful in constructing pagination for the
getSignatureList() method. 
				
Fetches the total number of signatures returned from
Emails::getSignatureList(), useful in constructing pagination for the
getSignatureList() method. Parameters
						$company_idinteger$company_id The company ID whose signatures to fetch
Returns
						integerThe total number of signatures
 
 See | 
		
			| 
				 public 
				array
				
				 | 
			#
			getAllSignatures( integer $company_id )
				
Retrieves a list of all signatures for this company 
				
Retrieves a list of all signatures for this company Parameters
						$company_idinteger$company_id The company ID whose signatures to fetch
Returns
						arrayAn array of stdClass objects each representing a signature
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getGroup( integer $email_group_id )
				
Fetches an email group Parameters
						$email_group_idinteger$email_group_id The email group ID
Returns
						mixedAn array of objects or false if no results.
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			getGroupList( string $sortby = "action", string $order = "asc" )
				
Fetches all email groups Parameters
						$sortbystring$sort_by The field to sort by
$orderstring$order The direction to order (asc, desc)
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			send( string $action, integer $company_id, string $lang, mixed $to, array $tags = null, mixed $cc = null, mixed $bcc = null, array $attachments = null, array $options = null )
				
Sends the given email using the criteria specified 
				
Sends the given email using the criteria specified Parameters
						$actionstring$action The action that specifies the email group to use
$company_idinteger$company_id The company ID to send this email under
$langstring$lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us) to
send, if no message found for this language will attempt to send using company's
default language
$tomixed$to The To address(es) to send to. A string, or an array of email addresses
$tagsarray$tags An array of replacement tags containing the key/value pairs for the
replacements where the key is the tag to replace and the value is the value to
replace it with
$ccmixed$cc The CC address(es) to send to. A string, or an array of email addresses
$bccmixed$bcc The BCC address(es) to send to. A string, or an array of email addresses
$attachmentsarray$attachments A multi-dimensional array of attachments containing: - path The
path to the attachment on the file system - name The name of the attachment
(optional, default '') - encoding The file encoding (optional, default 'base64')
- type The type of attachment (optional, default 'application/octet-stream')
$optionsarray$options An array of options including: - to_client_id The ID of the client the
message was sent to - from_staff_id The ID of the staff member the message was
sent from - from The from address - from_name The from name - reply_to The reply
to address
Returns
						booleanReturns true if the message was successfully sent, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			sendCustom( string $from, string $from_name, mixed $to, string $subject, array $body, array $tags = null, mixed $cc = null, mixed $bcc = null, array $attachments = null, array $options = null )
				
Sends a custom email using the criteria specified 
				
Sends a custom email using the criteria specified Parameters
						$fromstring$from The email address to send from.
$from_namestring$from_name The name to send from.
$tomixed$to The To address(es) to send to. A string, or an array of email addresses
$subjectstring$subject The subject of the message. Tags provided in the subject will be
evaluated by the template parser
$bodyarray$body An array containing the body in HTML and text of the email. Tags provided
in the body will be evaluated by the template parser: - html The HTML version of
the email (optional) - text The text version of the email (optional)
$tagsarray$tags An array of replacement tags containing the key/value pairs for the
replacements where the key is the tag to replace and the value is the value to
replace it with
$ccmixed$cc The CC address(es) to send to. A string, or an array of email addresses
$bccmixed$bcc The BCC address(es) to send to. A string, or an array of email addresses
$attachmentsarray$attachments A multi-dimensional array of attachments containing: - path The
path to the attachment on the file system - name The name of the attachment
(optional, default '') - encoding The file encoding (optional, default 'base64')
- type The type of attachment (optional, default 'application/octet-stream')
$optionsarray$options An array of options including: - to_client_id The ID of the client the
message was sent to - from_staff_id The ID of the staff member the message was
sent from - reply_to The reply to address
Returns
						booleanReturns true if the message was successfully sent, false otherwise
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			buildEmail( string $action, integer $company_id, string $lang, array $tags = null )
				
Parses an Email stdClass object using the given data ($tags) 
				
Parses an Email stdClass object using the given data ($tags) Parameters
						$actionstring$action The action that specifies the email group to use
$company_idinteger$company_id The company ID to send this email under
$langstring$lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us) to
send, if no message found for this language will attempt to send using company's
default language
$tagsarray$tags An array of replacement tags containing the key/value pairs for the
replacements where the key is the tag to replace and the value is the value to
replace it with
Returns
						mixedA stdClass object representing the parsed email template, false if no such
template exists
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateEmailGroupAction( string $action )
				
Validates that the given action is a valid email group action 
				
Validates that the given action is a valid email group action Parameters
						$actionstring$action The email group action
Returns
						booleanTrue if the action is valid, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateEmailAddresses( mixed $email_addresses )
				
Validates that each of the given email addresses provided are valid 
				
Validates that each of the given email addresses provided are valid Parameters
						$email_addressesmixedA string representing a single email address, or an array of email addresses
Returns
						booleanTrue if every email address is valid, false otherwise
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			validateAttachmentPaths( mixed $attachments )
				
Validates that the given attachments exist on the file system 
				
Validates that the given attachments exist on the file system | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateStatus( string $status )
				
Validates the emails 'status' field 
				
Validates the emails 'status' field Parameters
						$statusstring$status The status to check
Returns
						booleanTrue if status validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateSignatureExists( integer $signature_id, integer $company_id = null )
				
Validates the email signature submitted exists and belongs to the company ID
given 
				
Validates the email signature submitted exists and belongs to the company ID
given Parameters
						$signature_idinteger$signature_id The email signature ID
$company_idinteger$company_id The company ID (optional)
Returns
						booleanTrue if the signature exists and belongs to the company ID given, false
otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateSignatureInUse( integer $signature_id )
				
Checks whether the email signature given is in use by any email 
				
Checks whether the email signature given is in use by any email Parameters
						$signature_idinteger$signature_id The email signature ID
Returns
						booleanTrue if signature ID is in use, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateUnique( integer $company_id, integer $email_group_id, string $lang )
				
Validates the given company ID, email group ID, and language type are unique
for this email 
				
Validates the given company ID, email group ID, and language type are unique
for this email Parameters
						$company_idinteger$company_id The company ID
$email_group_idinteger$email_group_id The email group ID
$langstring$lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
(optional, default en_us)
Returns
						booleanTrue if the given info is unique, false otherwise
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			validateParse( string $str )
				
Validate that the given string parses template parsing 
				
Validate that the given string parses template parsing Parameters
						$strstring$str The string to test
 |