Open Journal Systems  3.3.0
MailTemplate Class Reference
Inheritance diagram for MailTemplate:
Mail DataObject MassMail SubmissionMailTemplate ArticleMailTemplate

Public Member Functions

 __construct ($emailKey=null, $locale=null, $context=null, $includeSignature=true)
 
 assignParams ($params=array())
 
 clearRecipients ($clearHeaders=true)
 
 getAddressFieldsEnabled ()
 
 hasErrors ()
 
 isEnabled ()
 
 manageURLValues ($targetString, $key, $value)
 
 replaceParams ()
 
 send ()
 
 sendWithParams ($params)
 
 setAddressFieldsEnabled ($addressFieldsEnabled)
 
- Public Member Functions inherited from Mail
 __construct ()
 
 addAttachment ($filePath, $fileName='', $contentType='', $contentDisposition='attachment')
 
 addBcc ($email, $name='')
 
 addCc ($email, $name='')
 
 addHeader ($name, $content)
 
 addPrivateParam ($name, $value)
 
 addRecipient ($email, $name='')
 
 addReplyTo ($email, $name='')
 
 clearAllRecipients ()
 
 getAddressArrayString ($addresses, $includeNames=true, $send=false)
 
getAttachments ()
 
 getBccs ()
 
 getBccString ()
 
 getBody ()
 
 getCcs ()
 
 getCcString ()
 
 getContentType ()
 
 getEnvelopeSender ()
 
 getFrom ()
 
 getFromString ($send=false)
 
 getHeaders ()
 
 getRecipients ()
 
 getRecipientString ()
 
 getReplyTo ()
 
 getReplyToString ($send=false)
 
 getSubject ()
 
 hasAttachments ()
 
 promoteCcsIfNoRecipients ()
 
 setBccs ($bccs)
 
 setBody ($body)
 
 setCcs ($ccs)
 
 setContentType ($contentType)
 
 setEnvelopeSender ($envelopeSender)
 
 setFrom ($email, $name='')
 
 setHeaders (&$headers)
 
 setPrivateParams ($privateParams)
 
 setRecipients ($recipients)
 
 setReplyTo ($email, $name='')
 
 setSubject ($subject)
 
- Public Member Functions inherited from DataObject
 addSupportedMetadataAdapter ($metadataAdapter)
 
 extractMetadata ($metadataSchema)
 
 getAdditionalMetadataFieldNames ()
 
getAllData ()
 
 getDAO ()
 
getData ($key, $locale=null)
 
 getHasLoadableAdapters ()
 
 getId ()
 
 getLocaleMetadataFieldNames ()
 
 getLocalizedData ($key, $preferredLocale=null)
 
 getMetadataFieldNames ($translated=true)
 
 getSetMetadataFieldNames ($translated=true)
 
 getSupportedExtractionAdapters ()
 
 getSupportedInjectionAdapters ()
 
 getSupportedMetadataSchemas ()
 
 hasData ($key, $locale=null)
 
 injectMetadata ($metadataDescription)
 
 removeSupportedMetadataAdapter ($metadataSchemaName)
 
 setAllData (&$data)
 
 setData ($key, $value, $locale=null)
 
 setHasLoadableAdapters ($hasLoadableAdapters)
 
 setId ($id)
 
 unsetData ($key, $locale=null)
 
 upcastTo ($targetObject)
 

Data Fields

 $addressFieldsEnabled
 
 $bccSender
 
 $context
 
 $emailKey
 
 $enabled
 
 $errorMessages
 
 $includeSignature
 
 $locale
 
 $params
 
- Data Fields inherited from Mail
 $privateParams
 
- Data Fields inherited from DataObject
 $_data = array()
 
 $_extractionAdaptersLoaded = false
 
 $_hasLoadableAdapters = false
 
 $_injectionAdaptersLoaded = false
 
 $_metadataExtractionAdapters = array()
 
 $_metadataInjectionAdapters = array()
 

Additional Inherited Members

- Static Public Member Functions inherited from Mail
static encodeDisplayName ($displayName, $send=false)
 

Detailed Description

Subclass of Mail for mailing a template email.

Definition at line 21 of file MailTemplate.inc.php.

Constructor & Destructor Documentation

◆ __construct()

MailTemplate::__construct (   $emailKey = null,
  $locale = null,
  $context = null,
  $includeSignature = true 
)

Constructor.

Parameters
$emailKeystring unique identifier for the template
$localestring locale of the template
$includeSignatureboolean optional

Definition at line 82 of file MailTemplate.inc.php.

References $context, $emailKey, $includeSignature, $locale, PKPServices\get(), PKPApplication\get(), AppLocale\getLocale(), Mail\setBody(), Mail\setFrom(), and Mail\setSubject().

Member Function Documentation

◆ assignParams()

MailTemplate::assignParams (   $params = array())

Assigns values to e-mail parameters.

Parameters
$paramsarray Associative array of variables to supply to the email template

Reimplemented in SubmissionMailTemplate, and ArticleMailTemplate.

Definition at line 168 of file MailTemplate.inc.php.

References $application, $params, and PKPApplication\get().

Referenced by sendWithParams().

◆ clearRecipients()

MailTemplate::clearRecipients (   $clearHeaders = true)

Clears the recipient, cc, and bcc lists.

Parameters
$clearHeadersboolean if true, also clear headers
Returns
void

Definition at line 291 of file MailTemplate.inc.php.

References DataObject\setData().

◆ getAddressFieldsEnabled()

MailTemplate::getAddressFieldsEnabled ( )

Get the enabled/disabled state of address fields on the email form.

Returns
boolean

Definition at line 152 of file MailTemplate.inc.php.

References $addressFieldsEnabled.

◆ hasErrors()

MailTemplate::hasErrors ( )

Check whether or not there were errors in the user input for this form.

Returns
boolean true iff one or more error messages are stored.

Definition at line 160 of file MailTemplate.inc.php.

◆ isEnabled()

MailTemplate::isEnabled ( )

Returns true if the email template is enabled; false otherwise.

Returns
boolean

Definition at line 208 of file MailTemplate.inc.php.

References $enabled.

◆ manageURLValues()

MailTemplate::manageURLValues (   $targetString,
  $key,
  $value 
)

Finds and changes appropriately URL valued template parameter keys.

Parameters
$targetStringstring The string that contains the original {$key}s template variables
$keystring The key we are looking for, and has an URL as its $value
$valuestring The value of the $key
Returns
string the $targetString replaced appropriately

Definition at line 307 of file MailTemplate.inc.php.

Referenced by replaceParams().

◆ replaceParams()

MailTemplate::replaceParams ( )

Replace template variables in the message body.

Parameters
$paramsarray Parameters to assign (augments anything provided via setParams)

Definition at line 246 of file MailTemplate.inc.php.

References Mail\getBody(), Mail\getSubject(), manageURLValues(), Mail\setBody(), and Mail\setSubject().

Referenced by send().

◆ send()

MailTemplate::send ( )

Send the email.

Returns
boolean false if there was a problem sending the email

Reimplemented from Mail.

Reimplemented in MassMail.

Definition at line 216 of file MailTemplate.inc.php.

References Mail\addBcc(), PKPApplication\get(), Mail\getBody(), Config\getVar(), replaceParams(), Mail\setBody(), and Mail\setEnvelopeSender().

Referenced by MassMail\send(), SubmissionMailTemplate\sendWithParams(), and sendWithParams().

◆ sendWithParams()

MailTemplate::sendWithParams (   $params)

Assigns user-specific values to email parameters, sends the email, then clears those values.

Parameters
$paramsarray Associative array of variables to supply to the email template
Returns
boolean false if there was a problem sending the email

Reimplemented in SubmissionMailTemplate.

Definition at line 271 of file MailTemplate.inc.php.

References assignParams(), Mail\getBody(), Mail\getHeaders(), Mail\getSubject(), send(), Mail\setBody(), Mail\setHeaders(), and Mail\setSubject().

◆ setAddressFieldsEnabled()

MailTemplate::setAddressFieldsEnabled (   $addressFieldsEnabled)

Disable or enable the address fields on the email form. NOTE: This affects the displayed form ONLY; if disabling the address fields, callers should manually clearAllRecipients and add/set recipients just prior to sending.

Parameters
$addressFieldsEnabledboolean

Definition at line 144 of file MailTemplate.inc.php.

References $addressFieldsEnabled.

Field Documentation

◆ $addressFieldsEnabled

boolean MailTemplate::$addressFieldsEnabled

Whether or not email fields are disabled

Definition at line 68 of file MailTemplate.inc.php.

Referenced by getAddressFieldsEnabled(), and setAddressFieldsEnabled().

◆ $bccSender

boolean MailTemplate::$bccSender

whether or not to bcc the sender

Definition at line 62 of file MailTemplate.inc.php.

◆ $context

object MailTemplate::$context

The context this message relates to

Definition at line 26 of file MailTemplate.inc.php.

Referenced by __construct().

◆ $emailKey

string MailTemplate::$emailKey

Key of the email template we are using

Definition at line 38 of file MailTemplate.inc.php.

Referenced by MassMail\__construct(), SubmissionMailTemplate\__construct(), and __construct().

◆ $enabled

boolean MailTemplate::$enabled

email template is enabled

Definition at line 50 of file MailTemplate.inc.php.

Referenced by isEnabled().

◆ $errorMessages

array MailTemplate::$errorMessages

List of errors to display to the user

Definition at line 56 of file MailTemplate.inc.php.

◆ $includeSignature

boolean MailTemplate::$includeSignature

whether to include the context's signature

Definition at line 32 of file MailTemplate.inc.php.

Referenced by SubmissionMailTemplate\__construct(), and __construct().

◆ $locale

string MailTemplate::$locale

locale of this template

Definition at line 44 of file MailTemplate.inc.php.

Referenced by MassMail\__construct(), SubmissionMailTemplate\__construct(), and __construct().

◆ $params

array MailTemplate::$params

The list of parameters to be assigned to the template.

Definition at line 74 of file MailTemplate.inc.php.

Referenced by assignParams().


The documentation for this class was generated from the following file: