LimeSurvey API - Master branch

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'

MethodSendmail

public mixed MethodSendmail = 'sendmail'

Properties

$aAttachements

public array<string|int, mixed> $aAttachements = array()

Current attachements (as string or array)

Tags
see
parent::addAttachment

$aUrlsPlaceholders

public mixed $aUrlsPlaceholders = []

$BodySubjectCharset

public string $BodySubjectCharset = 'utf-8'

Charset of Body and Subject

Tags
see
parent

@CharSet

$CharSet

public mixed $CharSet = 'utf-8'
Tags
inheritdoc

defaultto utf-8

$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 …

$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

$validator

public static string|callable $validator = 'php-idna'
Tags
inheritdoc

Set default to idna (unsure is needed : need an idna email to check since seems PHPMailer do the job here ?)

$_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'

Methods

__construct()

public __construct([mixed $exceptions = false ]) : mixed
Parameters
$exceptions : mixed = false
Tags
inheritdoc

Default exception to false (we use getError or getDebug) WIP Set all needed fixed in params

addAddress()

public addAddress(mixed $addressTo[, mixed $name = '' ]) : mixed
Parameters
$addressTo : mixed
$name : mixed = ''
Tags
inheritdoc

Fix first parameters if he had email + name ( Name format)

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
inheritdoc

Reset the attachementType done to false

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
string

getDebug()

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
see
parent::ErrorInfo
Return values
null|string

getEventMessage()

Return the event message

public getEventMessage() : string
Return values
string

getFrom()

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
LimeMailer

getIsHtml()

Find if current email is in HTML

public getIsHtml() : bool
Return values
bool

getResendEmailVars()

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
inheritdoc

Override to use a better html to text converter (ex. doesn't removes links)

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
throws
Exception
Return values
bool

resend()

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
throws
Exception
Return values
bool

Send()

public Send() : mixed
Tags
inheritdoc

Disable all sending in demoMode

sendMessage()

Construct and do what must be done before sending a message

public sendMessage() : bool
Return values
bool

setFrom()

public setFrom(mixed $from[, mixed $fromname = null ][, mixed $auto = true ]) : bool
Parameters
$from : mixed
$fromname : mixed = null
$auto : mixed = true
Tags
inheritdoc

Fix first parameters if he had email + name ( Name format)

Return values
bool

setSurvey()

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
see
self::addAddress

setToken()

Set token for this survey

public setToken(string $token) : void
Parameters
$token : string
Tags
throws
CException

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
inheritdoc

Adding php with idna support Must review , seems phpMailer have something with idn ? @see parent::idnSupported

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
returns

array

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()

        
On this page

Search results