API Docs for: WebTemplate API v2.0
Show:

WTMail Class

A Class to send email
Example:
$mail = new WTMail();
$mail->setFrom("contact@webtemplate.com.au", "WebTemplate");
$mail->setTo("contact@domain.com")
$mail->setContent("subject", "message", true); $mail->send();

Methods

addAttachment

(
  • path
  • [name]
)

Add an attachment to the email

Parameters:

  • path String

    The path to the file to attach

  • [name] String optional

    The name of the attachment

addEmbeddedImage

(
  • path
  • contentID
  • [name]
  • [encoding="base64"]
  • [mimeType]
)

Add an embedded image to the email
TODO: provide an example

Parameters:

  • path String

    The path to the image

  • contentID String

    The id used to identify the image

  • [name] String optional

    The name of the image

  • [encoding="base64"] String optional

    The encoding to be used for the image

  • [mimeType] String optional

    The mime type. If not supplied, the mime type will be determined from the extension

send

()

Send the email

setBCC

(
  • address
)

Set the blind carbon copy address for the email

Parameters:

  • address String

    The email address of the BCC recipient (Can be a comma separated list of addresses)

setCC

(
  • address
)

Set the carbon copy addresses for the email

Parameters:

  • address String

    The email address of the CC recipient (Can be a comma separated list of addresses)

setContent

(
  • subject
  • body
  • [bodyIsHTML=false]
  • altbody
)

Set the content of the email

Parameters:

  • subject String

    The subject of the email

  • body String

    The body of the email

  • [bodyIsHTML=false] Boolean optional

    Set to false if sending a HTML email

  • altbody String

    The plain text version of a HTML email

setEncrypt

(
  • doEncryption
  • publicKey
)

Set whether to encrypt the email

Parameters:

  • doEncryption Boolean

    Set to true to encrypt the email

  • publicKey String

    the gnupg public key to be used to encrypt the email

setFrom

(
  • address
  • [name]
)

Set who the email is from

Parameters:

  • address String

    The email address of the sender

  • [name] String optional

    The name of the sender

setReplyTo

(
  • address
)

Set the reply to address of the email

Parameters:

  • address String

    The reply to address of the email

setTo

(
  • address
)

Set who the email will be sent to

Parameters:

  • address String

    The email address of the person to send the email to