Wizards Toolkit Documentation

Email.php

This contains all Wizards Toolkit functions that involve emailing.

All rights reserved.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Tags
author
Programming Labs
license
All rights reserved
version
2.0

Table of Contents

wzSendMail()  : bool
Primary function to call to send emails.
wzPostmarkApp()  : bool
Called from wzSendMail, this uses PostmarkApp to send emails.
wzSendPHPMail()  : bool
Called from wzSendMail, this uses PHPMailer to send emails.
wzSaveEmailSent()  : mixed
wzNotifyViaEmailPlain()  : void
One-line method of sending an email <strong>without</strong> any email HTML template.
wzNotifyViaEmail()  : void
One-line method of sending an email using an email HTML template.

Functions

wzSendMail()

Primary function to call to send emails.

wzSendMail( array<string|int, mixed>  $fncEmailArray [, array<string|int, mixed>  $fncSaveArray = [] ][, array<string|int, mixed>  $fncAttachments = '' ] , string  $fncDebugLevel) : bool

If second parameter is passed then it will also save email information into wzEmailsSent data table.

Example call includes defining Email Array and optional Save Array like:
$pgMailArray = array(
'ToAddress' => $pgToEmail,
'ToName' => $pgUserName,
'Subject' => $pgSubject,
'Body' => $pgBody
);

$pgSaveArray = array (
'FromUID' => 0,
'EmailUID' => $pgEmailUID,
'ToUID' => $gloUserUID
);

if (wzSendMail($pgMailArray, $pgSaveArray)):
// show success message
endif;

Parameters
$fncEmailArray : array<string|int, mixed>
$fncSaveArray : array<string|int, mixed> = []
$fncAttachments : array<string|int, mixed> = ''

defaults to blank

$fncDebugLevel : string

defaults to 0

Tags
global

string $gloEmailMethod

global

string $gloTechSupport

global

string $gloDbConnection If not 'Live' then changes To address to $gloTechSupport and prepends 'TST: ' to subject

global

string $gloWebBaseURL replaces @website@ token

global

string $gloCoName replaces @CompanyName@ in both Subject and Body

uses
function

wzSendPHPMail or wzPostmarkApp depending on $gloEmailMethod value

Return values
bool

true if succeeds, false if email fails

wzPostmarkApp()

Called from wzSendMail, this uses PostmarkApp to send emails.

wzPostmarkApp(array<string|int, mixed> $fncEmailArray, array<string|int, mixed> $fncSaveArray[, string $fncAttachments = '' ]) : bool

If second parameter is passed then it will also save email information into wzEmailsSent data table. This uses curl method of calling PostmarkApp.

Parameters
$fncEmailArray : array<string|int, mixed>
$fncSaveArray : array<string|int, mixed>
$fncAttachments : string = ''

defaults to blank

Tags
global

string $gloPostmarkToken defined in wz/wzServerInfo.php

global

string $gloTechSupport will be used as the From email address; must be assigned in PostmarkApp

uses
function

wzSaveEmailSent to save email data if $fncSaveArray filled

link
https://postmarkapp.com/developer/user-guide/send-email-with-api/send-a-single-email
Return values
bool

true if succeeds, false if email fails

wzSendPHPMail()

Called from wzSendMail, this uses PHPMailer to send emails.

wzSendPHPMail( array<string|int, mixed>  $fncEmailArray[, array<string|int, mixed>  $fncSaveArray = [] ] [, string  $fncAttachments = '' ] , string  $fncDebugLevel) : bool

If second parameter is passed then it will also save email information into wzEmailsSent data table. This uses curl method of calling PostmarkApp.

Parameters
$fncEmailArray : array<string|int, mixed>
$fncSaveArray : array<string|int, mixed> = []
$fncAttachments : string = ''

defaults to blank

$fncDebugLevel : string

defaults to 0

Tags
global

string $gloTechSupport will be used as the From email address; must be assigned in PostmarkApp

global

string $gloWebBaseURL used for unsubscribe feature

global

string $gloEmailHost all these global variables are defined in wz/wzServerInfo.php

global

string $gloEmailMethod

global

string $gloEmailPort

global

string $gloEmailSMTPAuth

global

string $gloEmailUserName

global

string $gloEmailPassword

uses
function

wzSaveEmailSent to save email data if $fncSaveArray filled

link
https://postmarkapp.com/developer/user-guide/send-email-with-api/send-a-single-email
Return values
bool

true if succeeds, false if email fails

wzSaveEmailSent()

wzSaveEmailSent( mixed  $fncSqlFilter , mixed  $fncSaveArray) : mixed
Parameters
$fncSqlFilter : mixed
$fncSaveArray : mixed
Return values
mixed

wzNotifyViaEmailPlain()

One-line method of sending an email <strong>without</strong> any email HTML template.

wzNotifyViaEmailPlain ( string  $fncSubject , string  $fncMessage [, string  $fncToEmail = '' ][, array<string|int, mixed>  $fncSaveArray = [] ][, string  $fncCC = '' ]) : void

This defaults to sending email to $gloTechSupport definied in wtkServerInfo.php but you can pass both a To and a CC email

Parameters
$fncSubject : string
$fncMessage : string
  • body of email
$fncToEmail : string = ''
  • if blank then $gloTechSupport will be used
$fncSaveArray : array<string|int, mixed> = []
$fncCC : string = ''
  • email address to CC if desired
Return values
void

wzNotifyViaEmail()

One-line method of sending an email using an email HTML template.

wzNotifyViaEmail( string  $fncSubject , string  $fncMessage [, string  $fncToEmail = '' ] [, array<string|int, mixed>  $fncSaveArray = [] ] [, string  $fncCC = '' ] [, string  $fncTemplate = 'emailDark.htm' ][, string  $fncReplyTo = '' ] [, string  $fncAddNL2BR = 'Y' ] ) : void

This defaults to sending email to $gloTechSupport definied in wtkServerInfo.php but you can pass both a To and a CC email

Parameters
$fncSubject : string
$fncMessage : string
  • body of email
$fncToEmail : string = ''

if blank then $gloTechSupport will be used

$fncSaveArray : array<string|int, mixed> = []
$fncCC : string = ''

email address to CC if desired

$fncTemplate : string = 'emailDark.htm'

what HTML email template you want to use

$fncReplyTo : string = ''

the email addresss to have as the ReplyTo

$fncAddNL2BR : string = 'Y'

defaults to 'Y'; if set to 'Y' then does nl2br() on body of message

Tags
global

string $gloDarkLight if $fncTemplate is not set will default to 'email' . $gloDarkLight . '.htm'

Return values
void

Search results