PHP Class Gdn_Email, vanilla

All public methods return $this for chaining purposes. ie. $Email->Subject('Hi')->Message('Just saying hi!')- To('[email protected]')->Send();
Inheritance: extends Gdn_Pluggable
Datei anzeigen Open project: vanilla/vanilla Class Usage Examples

Public Properties

Property Type Description
$PhpMailer PHPMailer
$Skipped Recipients that were skipped because they lack permission.
$supportedFormats The supported email formats.

Protected Properties

Property Type Description
$emailTemplate The email body renderer. Use this to edit the email body.
$format The format of the email.

Public Methods

Method Description
__construct ( ) Constructor.
addHeader ( string $Name, string $Value ) : Gdn_Email Add a custom header to the outgoing email.
addTo ( $RecipientEmail, $RecipientName = '' )
bcc ( mixed $RecipientEmail, string $RecipientName = '' ) : Gdn_Email Adds to the "Bcc" recipient collection.
cc ( mixed $RecipientEmail, string $RecipientName = '' ) : Gdn_Email Adds to the "Cc" recipient collection.
charset ( $Use = '' )
clear ( ) : Gdn_Email Clears out all previously specified values for this object and restores it to the state it was in when it was instantiated.
formatMessage ( $message )
from ( string $SenderEmail = '', string $SenderName = '', boolean $bOverrideSender = false ) : Gdn_Email Allows the explicit definition of the email's sender address & name.
getEmailTemplate ( ) : EmailTemplate
getFormat ( ) : string Get email format
getHTMLVersion ( $template ) : mixed | string
getTextVersion ( $template ) : boolean | mixed | string
masterView ( string $MasterView ) : Gdn_Email Allows the definition of a masterview other than the default: "email.master".
message ( string $message, boolean $convertNewlines = true, boolean $filter = true ) : Gdn_Email The message to be sent.
mimeType ( string $MimeType ) : Gdn_Email Sets the mime-type of the email.
send ( string $EventName = '' ) : boolean
setEmailTemplate ( EmailTemplate $emailTemplate ) : Gdn_Email
setFormat ( string $format ) : Gdn_Email Sets the format property, the email mime type and the email template format property.
subject ( string $Subject ) : Gdn_Email Adds subject of the message to the email.
to ( mixed $RecipientEmail, string $RecipientName = '' ) : Gdn_Email Adds to the "To" recipient collection.

Protected Methods

Method Description
resolveFormat ( ) Sets the format property based on the config, and defaults to html.

Method Details

__construct() public method

Constructor.
public __construct ( )

addHeader() public method

Add a custom header to the outgoing email.
Since: 2.1
public addHeader ( string $Name, string $Value ) : Gdn_Email
$Name string
$Value string
return Gdn_Email

addTo() public method

public addTo ( $RecipientEmail, $RecipientName = '' )

bcc() public method

Adds to the "Bcc" recipient collection.
public bcc ( mixed $RecipientEmail, string $RecipientName = '' ) : Gdn_Email
$RecipientEmail mixed An email (or array of emails) to add to the "Bcc" recipient collection.
$RecipientName string The recipient name associated with $RecipientEmail. If $RecipientEmail is an array of email addresses, this value will be ignored.
return Gdn_Email

cc() public method

Adds to the "Cc" recipient collection.
public cc ( mixed $RecipientEmail, string $RecipientName = '' ) : Gdn_Email
$RecipientEmail mixed An email (or array of emails) to add to the "Cc" recipient collection.
$RecipientName string The recipient name associated with $RecipientEmail. If $RecipientEmail is an array of email addresses, this value will be ignored.
return Gdn_Email

charset() public method

public charset ( $Use = '' )

clear() public method

Clears out all previously specified values for this object and restores it to the state it was in when it was instantiated.
public clear ( ) : Gdn_Email
return Gdn_Email

formatMessage() public method

public formatMessage ( $message )

from() public method

Defaults to the applications Configuration 'SupportEmail' & 'SupportName' settings respectively.
public from ( string $SenderEmail = '', string $SenderName = '', boolean $bOverrideSender = false ) : Gdn_Email
$SenderEmail string
$SenderName string
$bOverrideSender boolean optional. default false.
return Gdn_Email

getEmailTemplate() public method

public getEmailTemplate ( ) : EmailTemplate
return EmailTemplate The email body renderer.

getFormat() public method

Returns 'text' or 'html'.
public getFormat ( ) : string
return string

getHTMLVersion() public static method

public static getHTMLVersion ( $template ) : mixed | string
$template
return mixed | string

getTextVersion() public static method

public static getTextVersion ( $template ) : boolean | mixed | string
$template
return boolean | mixed | string

masterView() public method

Allows the definition of a masterview other than the default: "email.master".
Deprecation: since version 2.2
public masterView ( string $MasterView ) : Gdn_Email
$MasterView string
return Gdn_Email

message() public method

The message to be sent.
public message ( string $message, boolean $convertNewlines = true, boolean $filter = true ) : Gdn_Email
$message string The body of the message to be sent.
$convertNewlines boolean Optional. Convert newlines to br tags
$filter boolean Optional. Filter HTML.
return Gdn_Email

mimeType() public method

Only accept text/plain or text/html.
public mimeType ( string $MimeType ) : Gdn_Email
$MimeType string The mime-type of the email.
return Gdn_Email

resolveFormat() protected method

Sets the format property based on the config, and defaults to html.
protected resolveFormat ( )

send() public method

public send ( string $EventName = '' ) : boolean
$EventName string
return boolean

setEmailTemplate() public method

public setEmailTemplate ( EmailTemplate $emailTemplate ) : Gdn_Email
$emailTemplate EmailTemplate The email body renderer.
return Gdn_Email

setFormat() public method

Sets the format property, the email mime type and the email template format property.
public setFormat ( string $format ) : Gdn_Email
$format string The format of the email. Must be in the $supportedFormats array.
return Gdn_Email

subject() public method

Adds subject of the message to the email.
public subject ( string $Subject ) : Gdn_Email
$Subject string The subject of the message.
return Gdn_Email

to() public method

Adds to the "To" recipient collection.
public to ( mixed $RecipientEmail, string $RecipientName = '' ) : Gdn_Email
$RecipientEmail mixed An email (or array of emails) to add to the "To" recipient collection.
$RecipientName string The recipient name associated with $RecipientEmail. If $RecipientEmail is an array of email addresses, this value will be ignored.
return Gdn_Email

Property Details

$PhpMailer public_oe property

public PHPMailer $PhpMailer
return PHPMailer

$Skipped public_oe property

Recipients that were skipped because they lack permission.
public $Skipped

$emailTemplate protected_oe property

The email body renderer. Use this to edit the email body.
protected $emailTemplate

$format protected_oe property

The format of the email.
protected $format

$supportedFormats public_oe static_oe property

The supported email formats.
public static $supportedFormats