Jet\Mailing_Email

The class represents an email, i.e. a specific message to send. The class can be used on its own, but is primarily intended to be used throughout the emailing subsystem in conjunction with templates.

Overview of methods

Method Meaning of
public setSenderName(
string $sender_name
) : void
Sets the sender's name.
public getSenderName(
) : string
Returns the set sender name.
public setSenderEmail(
string $sender_email
) : void
Sets the sender's email.
public getSenderEmail(
) : string
Returns the sender's configured email.
public setTo(
array|string $to
) : void
Sets a recipient, or multiple recipients.
public getTo(
) : array|string
Returns the set recipients.
public setToCopy(
array|string $to_copy
) : void
Sets a recipient in a copy, or multiple recipients in a copy.
public getToCopy(
) : array|string
Returns the set recipients in a copy.
public setToHiddenCopy(
array|string $to_hidden_copy
) : void
Sets a recipient in the hidden copy, or multiple recipients in the hidden copy.
public getToHiddenCopy(
) : array|string
Returns the set recipients in a hidden copy.
public setSubject(
string $subject
) : void
Sets the subject of the email
public getSubject(
) : string
Returns the set email subject
public setBodyTxt(
string $body_txt
) : void
Sets the textual content (plain text) of the message.
public getBodyTxt(
) : string
Returns the set text content (plain text) of the message.
public setBodyHtml(
string $body_html,
bool $parse_images=true
) : void
Sets the HTML content of the message. If the parameter $parse_images is true, then it finds references to images in the HTML and prepares to insert them directly into the message.

Attention! Images must be located in the directory specified by system configuration SysConf_Path::getImages()
public getBodyHtml(
) : string
Returns the set HTML content of the message.
public addAttachments(
string $file_path,
string $file_name=''
) : void
Attaches the file as an email attachment.

Parameters:
  • $file_path
    The full path to the file to become an attachment
  • $file_name
    File name - attachments. Optional parameter - if not specified, the original file name is automatically used.
public getAttachments(
) : array
Returns a list of attachments in the form of an associated array, where the key is the name of the attachment file and the value is the full path to the file.
public addImage(
string $cid,
string $path
) : void
Adds an image that will be included in the email.
Parameters:
  • $cid
    Wildcard ID of the image as represented in HTML (src="cid:xxxxxxx").
  • $path
    Full path to the image file.
The method is primarily used internally when using the setBodyHtml method, but it can be used separately if you don't want to rely on the internal image search system in the HTML message body.
public getImages(
) : array
Returns a list of message images in the form of an associated array, where the key is the image cid and the value is the full path to the image file.
public setCustomHeader(
string $header,
string $value
) : void
Sets an optional SMTP message header.
Parameters:
  • $header
    Header Name.
  • $value
    Header value.
public getCustomHeaders(
) : array
Returns the configured optional SMTP message headers in the form of an associated field, where the key is the header name and the value is its value.
public prepareMessage(
?string &$message,
?string &$header
) : void
Compiles the actual email to send. That is, it assembles its body and prepares the necessary SMTP headers. Both values (message body and header) are returned as references.
public send(
) : bool
It sends the email. It is actually a call to: Mailing::sendEmail$this );
Previous chapter
Jet\Mailing
Next chapter
Jet\Mailing_Email_Template