LimeMailer
extends PHPMailer
in package
WIP A SubClass of phpMailer adapted for LimeSurvey
Table of Contents
Constants
- MethodMail = 'mail'
- Email methods
- MethodPlugin = 'plugin'
- MethodQmail = 'qmail'
- MethodSendmail = 'sendmail'
- MethodSmtp = 'smtp'
- ResetBase = 1
- ResetComplete = 2
- ResetNone = 0
- Reset part
Properties
- $aAttachements : array<string|int, mixed>
- $aReplacements : mixed
- $aUrlsPlaceholders : mixed
- $BodySubjectCharset : string
- $CharSet : mixed
- $debug : mixed
- $emailType : string
- $html : mixed
- $mailLanguage : mixed
- $oToken : mixed
- $rawBody : string
- The Rw Body of the message, before any Expression Replacements and other update
- $rawSubject : string
- The Raw Subject of the message. before any Expression Replacements and other update
- $replaceTokenAttributes : bool
- $surveyId : mixed
- $validator : string|callable
- $_aAttachementByType : array<string|int, string>
- Attachements by type : using different key for all this part …
- $_bAttachementTypeDone : bool
- $eventMessage : mixed
- $eventName : mixed
- $instance : LimeMailer
- Singleton
Methods
- __construct() : mixed
- addAddress() : mixed
- addAttachementsByType() : mixed
- Set the attachments according to current survey,language and emailtype @ return void
- addDebug() : void
- Add a debug line (with a new line like SMTP echo)
- addUrlsPlaceholders() : void
- Add url place holder
- clearAttachments() : mixed
- doReplacements() : string
- Do the replacements : if current replacement jey is set and LimeSurvey core have it too : it reset to the needed one.
- getDebug() : null|string|array<string|int, mixed>
- Hate to use global var maybe add format : raw (array of errors), html : clean html etc …
- getError() : null|string
- Get the the most recent mailer error message.
- getEventMessage() : string
- Return the event message
- getFrom() : string
- Get from
- getInstance() : LimeMailer
- To get a singleton : some part are not needed to do X times
- getIsHtml() : bool
- Find if current email is in HTML
- getResendEmailVars() : array<string|int, mixed>
- Variables needed to resend saved emails
- getTokenReplacements() : array<string|int, string>
- Get the replacements for token.
- html2text() : mixed
- init() : mixed
- Set the minimal default for LimeSurvey
- preResend() : bool
- preResend function that sets values for the resending process @see resend()
- resend() : bool
- resend functionality for phpmailer, can resend saved MIME body
- Send() : mixed
- sendMessage() : bool
- Construct and do what must be done before sending a message
- setFrom() : bool
- setSurvey() : void
- Set email for this survey If surveyId are not updated : no reset of from or sender
- setTo() : void
- Set the to
- setToken() : void
- Set token for this survey
- setTypeWithRaw() : mixed
- set the rawSubject and rawBody according to type See if must throw error without
- validateAddress() : mixed
- validateAddresses() : string
- Validate an list of email addresses - either as array or as semicolon-limited text
- attachementExists() : mixed
- manageEvent() : mixed
- Launch the needed event : beforeTokenEmail, beforeSurveyEmail, beforeEmail and update this according to action
Constants
MethodMail
Email methods
public
mixed
MethodMail
= 'mail'
MethodPlugin
public
mixed
MethodPlugin
= 'plugin'
MethodQmail
public
mixed
MethodQmail
= 'qmail'
MethodSendmail
public
mixed
MethodSendmail
= 'sendmail'
MethodSmtp
public
mixed
MethodSmtp
= 'smtp'
ResetBase
public
mixed
ResetBase
= 1
ResetComplete
public
mixed
ResetComplete
= 2
ResetNone
Reset part
public
mixed
ResetNone
= 0
Properties
$aAttachements
public
array<string|int, mixed>
$aAttachements
= array()
Current attachements (as string or array)
Tags
$aReplacements
public
mixed
$aReplacements
= []
$aUrlsPlaceholders
public
mixed
$aUrlsPlaceholders
= []
$BodySubjectCharset
public
string
$BodySubjectCharset
= 'utf-8'
Charset of Body and Subject
Tags
$CharSet
public
mixed
$CharSet
= 'utf-8'
Tags
$debug
public
mixed
$debug
= array()
$emailType
public
string
$emailType
= 'unknow'
Current email type, used for updating email raw subject and body for token (in survey) : invite, remind, confirm, register … for survey (admin or not) : admin_notification, admin_responses, savesurveydetails, errorsavingresults other : addadminuser, passwordreminderadminuser, mailsendusergroup …
$html
public
mixed
$html
= \true
$mailLanguage
public
mixed
$mailLanguage
$oToken
public
mixed
$oToken
$rawBody
The Rw Body of the message, before any Expression Replacements and other update
public
string
$rawBody
= ''
$rawSubject
The Raw Subject of the message. before any Expression Replacements and other update
public
string
$rawSubject
= ''
$rawBody
$replaceTokenAttributes
public
bool
$replaceTokenAttributes
= \false
replace token attributes (FIRSTNAME etc …) and replace to TOKEN:XXX by XXXX
$surveyId
public
mixed
$surveyId
$validator
public
static string|callable
$validator
= 'php-idna'
Tags
$_aAttachementByType
Attachements by type : using different key for all this part …
private
array<string|int, string>
$_aAttachementByType
= array('invite' => 'invitation', 'remind' => 'reminder', 'register' => 'registration', 'confirm' => 'confirmation', 'admin_notification' => 'admin_notification', 'admin_responses' => 'admin_detailed_notification')
$_bAttachementTypeDone
private
bool
$_bAttachementTypeDone
= \false
Current attachements (as string or array)
$eventMessage
private
mixed
$eventMessage
= \null
$eventName
private
mixed
$eventName
= 'beforeEmail'
$instance
Singleton
private
static LimeMailer
$instance
= \null
Methods
__construct()
public
__construct([mixed $exceptions = false ]) : mixed
Parameters
- $exceptions : mixed = false
Tags
addAddress()
public
addAddress(mixed $addressTo[, mixed $name = '' ]) : mixed
Parameters
- $addressTo : mixed
- $name : mixed = ''
Tags
addAttachementsByType()
Set the attachments according to current survey,language and emailtype @ return void
public
addAttachementsByType() : mixed
addDebug()
Add a debug line (with a new line like SMTP echo)
public
addDebug(mixed $str[, mixed $level = 0 ]) : void
Parameters
- $str : mixed
- $level : mixed = 0
addUrlsPlaceholders()
Add url place holder
public
addUrlsPlaceholders(string|array<string|int, string> $aUrlsPlaceholders) : void
Parameters
- $aUrlsPlaceholders : string|array<string|int, string>
-
an array of url placeholder to set automatically
clearAttachments()
public
clearAttachments() : mixed
Tags
doReplacements()
Do the replacements : if current replacement jey is set and LimeSurvey core have it too : it reset to the needed one.
public
doReplacements(string $string) : string
Parameters
- $string : string
-
wher need to replace
Return values
stringgetDebug()
Hate to use global var maybe add format : raw (array of errors), html : clean html etc …
public
getDebug([string $format = '' ]) : null|string|array<string|int, mixed>
Parameters
- $format : string = ''
-
(currently only html or null (return array))
Return values
null|string|array<string|int, mixed>getError()
Get the the most recent mailer error message.
public
getError() : null|string
Tags
Return values
null|stringgetEventMessage()
Return the event message
public
getEventMessage() : string
Return values
stringgetFrom()
Get from
public
getFrom() : string
Return values
string —from (name
getInstance()
To get a singleton : some part are not needed to do X times
public
static getInstance([int $reset = self::ResetBase ]) : LimeMailer
Parameters
- $reset : int = self::ResetBase
-
totally or partially the instance
Return values
LimeMailergetIsHtml()
Find if current email is in HTML
public
getIsHtml() : bool
Return values
boolgetResendEmailVars()
Variables needed to resend saved emails
public
getResendEmailVars() : array<string|int, mixed>
Return values
array<string|int, mixed>getTokenReplacements()
Get the replacements for token.
public
getTokenReplacements() : array<string|int, string>
Return values
array<string|int, string>html2text()
public
html2text(mixed $html[, mixed $advanced = false ]) : mixed
Parameters
- $html : mixed
- $advanced : mixed = false
Tags
init()
Set the minimal default for LimeSurvey
public
init() : mixed
preResend()
preResend function that sets values for the resending process @see resend()
public
preResend( $resendVars) : bool
Parameters
- $resendVars :
-
array variables needed for a resend [message_type,Subject,uniqueid,boundary[1],boundary[2],boundary[3],MIMEBody]
Tags
Return values
boolresend()
resend functionality for phpmailer, can resend saved MIME body
public
resend( $resendVars) : bool
Parameters
- $resendVars :
-
array variables needed for a resend [message_type,Subject,uniqueid,boundary[1],boundary[2],boundary[3],MIMEBody]
Tags
Return values
boolSend()
public
Send() : mixed
Tags
sendMessage()
Construct and do what must be done before sending a message
public
sendMessage() : bool
Return values
boolsetFrom()
public
setFrom(mixed $from[, mixed $fromname = null ][, mixed $auto = true ]) : bool
Parameters
- $from : mixed
- $fromname : mixed = null
- $auto : mixed = true
Tags
Return values
boolsetSurvey()
Set email for this survey If surveyId are not updated : no reset of from or sender
public
setSurvey(int $surveyId) : void
Parameters
- $surveyId : int
setTo()
Set the to
public
setTo(mixed $addressTo[, mixed $name = '' ]) : void
Parameters
- $addressTo : mixed
- $name : mixed = ''
Tags
setToken()
Set token for this survey
public
setToken(string $token) : void
Parameters
- $token : string
Tags
setTypeWithRaw()
set the rawSubject and rawBody according to type See if must throw error without
public
setTypeWithRaw(string|null $emailType[, string|null $language = null ]) : mixed
Parameters
- $emailType : string|null
-
set the rawSubject and rawBody at same time
- $language : string|null = null
-
forced language
validateAddress()
public
static validateAddress(mixed $address[, mixed $patternselect = null ]) : mixed
Parameters
- $address : mixed
- $patternselect : mixed = null
Tags
validateAddresses()
Validate an list of email addresses - either as array or as semicolon-limited text
public
static validateAddresses(string $aEmailAddressList[, string|callable $patternselect = null ]) : string
Parameters
- $aEmailAddressList : string
-
Email address to check
- $patternselect : string|callable = null
-
Which pattern to use (default to static::$validator)
Tags
Return values
string —List with valid email addresses - invalid email addresses are filtered - false if none of the email addresses are valid
attachementExists()
private
attachementExists(mixed $aAttachment) : mixed
Parameters
- $aAttachment : mixed
manageEvent()
Launch the needed event : beforeTokenEmail, beforeSurveyEmail, beforeEmail and update this according to action
private
manageEvent([mixed $eventParams = array() ]) : mixed
Parameters
- $eventParams : mixed = array()