Piwik\

Mail

Class for sending mails

Methods

The class defines the following methods:

__construct()

Signature

setFrom()

Sets the sender.

Signature

  • It accepts the following parameter(s):
    • $email (string) — Email address of the sender.
    • $name (null|string) — Name of the sender.
  • It does not return anything or a mixed result.

setDefaultFromPiwik()

Sets the default sender

Signature

  • It does not return anything or a mixed result.
  • It throws one of the following exceptions:
    • DI\NotFoundException

getFrom()

Returns the address the mail will be sent from

Signature

  • It returns a string value.

getFromName()

Returns the address the mail will be sent from

Signature

  • It returns a string value.

setWrappedHtmlBody()

Signature

  • It accepts the following parameter(s):

    • $body (View|string) —
  • It does not return anything or a mixed result.

  • It throws one of the following exceptions:
    • DI\NotFoundException

setBodyHtml()

Sets the HTML part of the mail

Signature

  • It accepts the following parameter(s):

    • $html
  • It does not return anything or a mixed result.

setBodyText()

Sets the text part of the mail.

If bodyHtml is set, this will be used as alternative text part

Signature

  • It accepts the following parameter(s):

    • $txt
  • It does not return anything or a mixed result.

getBodyHtml()

Returns html content of the mail

Signature

  • It returns a string value.

getBodyText()

Returns text content of the mail

Signature

  • It returns a string value.

setSubject()

Sets the subject of the mail

Signature

  • It accepts the following parameter(s):

    • $subject
  • It does not return anything or a mixed result.

getSubject()

Return the subject of the mail

Signature

  • It returns a string value.

addTo()

Adds a recipient

Signature

  • It accepts the following parameter(s):

    • $address (string) —

    • $name (string) —

  • It does not return anything or a mixed result.

getRecipients()

Returns the list of recipients

Signature

  • It returns a array value.

addBcc()

Add Bcc address

Signature

  • It accepts the following parameter(s):

    • $email (string) —

    • $name (null|string) —

  • It does not return anything or a mixed result.

getBccs()

Returns the list of bcc addresses

Signature

  • It returns a array value.

clearAllRecipients()

Removes all recipients and bccs from the list

Signature

  • It does not return anything or a mixed result.

addReplyTo()

Add Reply-To address

Signature

  • It accepts the following parameter(s):

    • $email (string) —

    • $name (null|string) —

  • It does not return anything or a mixed result.

setReplyTo()

Sets the reply to address (all previously added addresses will be removed)

Signature

  • It accepts the following parameter(s):

    • $email (string) —

    • $name (string) —

  • It does not return anything or a mixed result.

getReplyTos()

Returns the list of reply to addresses

Signature

  • It returns a array value.

addAttachment()

Signature

  • It accepts the following parameter(s):

    • $body

    • $mimeType

    • $filename

    • $cid

  • It does not return anything or a mixed result.

getAttachments()

Signature

  • It does not return anything or a mixed result.

send()

Sends the mail

Signature

  • It returns a bool value.
  • It throws one of the following exceptions:
    • DI\NotFoundException

setSmtpDebug()

Enables SMTP debugging

Signature

  • It accepts the following parameter(s):

    • $smtpDebug (bool) —
  • It does not return anything or a mixed result.

isSmtpDebugEnabled()

Returns whether SMTP debugging is enabled or not

Signature

  • It returns a bool value.

getMailHost()

Returns the hostname mails will be sent from

Signature

  • It returns a string value.

sanitiseString()

Replaces characters known to appear incorrectly in some email clients

Signature

  • It accepts the following parameter(s):

    • $string
  • It returns a mixed value.