[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Mail/ -> MailTemplate.php (summary)

Joomla! Content Management System

Copyright: (C) 2019 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 484 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

MailTemplate:: (12 methods):
  __construct()
  addAttachment()
  addRecipient()
  setReplyTo()
  addTemplateData()
  send()
  replaceTags()
  getTemplate()
  createTemplate()
  updateTemplate()
  deleteTemplate()
  getAttachmentName()


Class: MailTemplate  - X-Ref

Email Templating Class

__construct($templateId, $language, Mail $mailer = null)   X-Ref
Constructor for the mail templating class

param: string  $templateId  Id of the mail template.
param: string  $language    Language of the template to use.
param: Mail    $mailer      Mail object to send the mail with.

addAttachment($name, $file)   X-Ref
Add an attachment to the mail

param: string  $name  Filename of the attachment
param: string  $file  Either a filepath or filecontent
return: void

addRecipient($mail, $name = null, $type = 'to')   X-Ref
Adds recipients for this mail

param: string  $mail  Mail address of the recipient
param: string  $name  Name of the recipient
param: string  $type  How should the recipient receive the mail? ('to', 'cc', 'bcc')
return: void

setReplyTo($mail, $name = '')   X-Ref
Set reply to for this mail

param: string  $mail  Mail address to reply to
param: string  $name  Name
return: void

addTemplateData($data)   X-Ref
Add data to replace in the template

param: array  $data  Associative array of strings to replace
return: void

send()   X-Ref
Render and send the mail

return: boolean  True on success

replaceTags($text, $tags)   X-Ref
Replace tags with their values recursively

param: string  $text  The template to process
param: array   $tags  An associative array to replace in the template
return: string  Rendered mail template

getTemplate($key, $language)   X-Ref
Get a specific mail template

param: string  $key       Template identifier
param: string  $language  Language code of the template
return: object|null  An object with the data of the mail, or null if the template not found in the db.

createTemplate($key, $subject, $body, $tags, $htmlbody = '')   X-Ref
Insert a new mail template into the system

param: string  $key       Mail template key
param: string  $subject   A default subject (normally a translatable string)
param: string  $body      A default body (normally a translatable string)
param: array   $tags      Associative array of tags to replace
param: string  $htmlbody  A default htmlbody (normally a translatable string)
return: boolean  True on success, false on failure

updateTemplate($key, $subject, $body, $tags, $htmlbody = '')   X-Ref
Update an existing mail template

param: string  $key       Mail template key
param: string  $subject   A default subject (normally a translatable string)
param: string  $body      A default body (normally a translatable string)
param: array   $tags      Associative array of tags to replace
param: string  $htmlbody  A default htmlbody (normally a translatable string)
return: boolean  True on success, false on failure

deleteTemplate($key)   X-Ref
Method to delete a mail template

param: string  $key  The key of the mail template
return: boolean  True on success, false on failure

getAttachmentName(string $file, string $name)   X-Ref
Check and if necessary fix the file name of an attachment so that the attached file
has the same extension as the source file, and not a different file extension

param: string  $file  Path to the file to be attached
param: string  $name  The file name to be used for the attachment
return: string  The corrected file name for the attachment



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer