Piwik\
Class for sending mails
The class defines the following methods:
__construct()
setFrom()
— Sets the sender.setDefaultFromPiwik()
— Sets the default sendergetFrom()
— Returns the address the mail will be sent fromgetFromName()
— Returns the address the mail will be sent fromsetWrappedHtmlBody()
setBodyHtml()
— Sets the HTML part of the mailsetBodyText()
— Sets the text part of the mail.getBodyHtml()
— Returns html content of the mailgetBodyText()
— Returns text content of the mailsetSubject()
— Sets the subject of the mailgetSubject()
— Return the subject of the mailaddTo()
— Adds a recipientgetRecipients()
— Returns the list of recipientsaddBcc()
— Add Bcc addressgetBccs()
— Returns the list of bcc addressesclearAllRecipients()
— Removes all recipients and bccs from the listaddReplyTo()
— Add Reply-To addresssetReplyTo()
— Sets the reply to address (all previously added addresses will be removed)getReplyTos()
— Returns the list of reply to addressesaddAttachment()
getAttachments()
send()
— Sends the mailsafeSend()
— If the send email process throws an exception, we catch it and log itsetSmtpDebug()
— Enables SMTP debuggingisSmtpDebugEnabled()
— Returns whether SMTP debugging is enabled or notgetMailHost()
— Returns the hostname mails will be sent fromsanitiseString()
— Replaces characters known to appear incorrectly in some email clients__construct()
setFrom()
Sets the sender.
$email
(string
) —
Email address of the sender.$name
(null
|string
) —
Name of the sender.setDefaultFromPiwik()
Sets the default sender
DI\NotFoundException
getFrom()
Returns the address the mail will be sent from
string
value.getFromName()
Returns the address the mail will be sent from
string
value.setWrappedHtmlBody()
It accepts the following parameter(s):
$body
(View
|string
) —It does not return anything or a mixed result.
DI\NotFoundException
setBodyHtml()
Sets the HTML part of the mail
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
It accepts the following parameter(s):
$txt
It does not return anything or a mixed result.
getBodyHtml()
Returns html content of the mail
string
value.getBodyText()
Returns text content of the mail
string
value.setSubject()
Sets the subject of the mail
It accepts the following parameter(s):
$subject
It does not return anything or a mixed result.
getSubject()
Return the subject of the mail
string
value.addTo()
Adds a recipient
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
array
value.addBcc()
Add Bcc address
It accepts the following parameter(s):
$email
(string
) —
$name
(string
) —
It does not return anything or a mixed result.
getBccs()
Returns the list of bcc addresses
array
value.clearAllRecipients()
Removes all recipients and bccs from the list
addReplyTo()
Add Reply-To address
It accepts the following parameter(s):
$email
(string
) —
$name
(string
) —
It does not return anything or a mixed result.
setReplyTo()
Sets the reply to address (all previously added addresses will be removed)
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
array
value.addAttachment()
It accepts the following parameter(s):
$body
$mimeType
$filename
$cid
It does not return anything or a mixed result.
getAttachments()
send()
Sends the mail
bool
|null
—
returns null if sending the mail was aborted by the Mail.send eventDI\NotFoundException
safeSend()
If the send email process throws an exception, we catch it and log it
void
value.DI\NotFoundException
DI\DependencyException
setSmtpDebug()
Enables SMTP debugging
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
bool
value.getMailHost()
Returns the hostname mails will be sent from
string
value.sanitiseString()
Replaces characters known to appear incorrectly in some email clients
It accepts the following parameter(s):
$string
It returns a mixed
value.