LimeSurvey API - Master branch

LimeMailer extends PHPMailer
in package

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

$aAttachments  : array<string|int, mixed>
$aReplacements  : mixed
$aUrlsPlaceholders  : mixed
$BodySubjectCharset  : string
$CharSet  : mixed
$debug  : mixed
$emailType  : string
$html  : mixed
$ignoremissingattachement  : bool
$index  : 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
$_aAttachmentByType  : array<string|int, string>
Attachments by type : using different key for all this part …
$_bAttachementTypeDone  : bool
$eventMessage  : mixed
$eventName  : mixed
$instance  : LimeMailer
Singleton

Methods

__construct()  : mixed
addAddress()  : mixed
addAttachmentsByType()  : bool
Set the attachments according to current survey,language and emailtype
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()  : void
Sets the email type and raw content for a survey email.
validateAddress()  : mixed
validateAddresses()  : array<string|int, string>|false
Validate a list of email addresses - either as array or as comma or semicolon-limited text
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

$aAttachments

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

Current Attachments (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 = 'unknown'

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 …

$ignoremissingattachement

public bool $ignoremissingattachement = \false

allow to send if attachement have issue.

$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 ?)

$_aAttachmentByType

Attachments by type : using different key for all this part …

private array<string|int, string> $_aAttachmentByType = array('invite' => 'invitation', 'remind' => 'reminder', 'register' => 'registration', 'confirm' => 'confirmation', 'admin_notification' => 'admin_notification', 'admin_responses' => 'admin_detailed_notification')

$_bAttachementTypeDone

private bool $_bAttachementTypeDone = \false

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

addAttachmentsByType()

Set the attachments according to current survey,language and emailtype

public addAttachmentsByType() : bool
Return values
bool

attachments added with success

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

where 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

True if sending was successful, false otherwise.

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

Sets the email type and raw content for a survey email.

public setTypeWithRaw(string $emailType[, string|null $language = null ]) : void

This function sets the email type, determines the appropriate language, and retrieves the raw subject and body content for the specified email type from the survey language settings.

Parameters
$emailType : string

The type of email (e.g., 'invite', 'remind', 'register', etc.)

$language : string|null = null

The language code for the email content. If null, it will use the token's language or the survey's default language.

Tags
throws
CException

If the survey ID is not set

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 a list of email addresses - either as array or as comma or semicolon-limited text

public static validateAddresses(string|array<string|int, string> $aEmailAddressList[, string|callable $patternselect = null ]) : array<string|int, string>|false
Parameters
$aEmailAddressList : string|array<string|int, string>

Email address to check

$patternselect : string|callable = null

Which pattern to use (default to static::$validator)

Return values
array<string|int, string>|false

List with valid email addresses - invalid email addresses are filtered - false if none of the email addresses are valid

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