Send_Email
in package
Send email from pNet admin tools page.
- Send HTML email.
Tags
Table of Contents
Constants
- ATTACHMENTS_DIR = 'attachments'
- The attachments folder name.
- CAPABILITY = 'manage_options'
- The user capability required to run this tool.
- EXTENSION_WHITELIST = array('jpeg', 'jpg', 'pdf', 'pdf', 'png')
- The the whitelist of attachment extensions.
Properties
- $attachments_dir : string
- The fully qualified path to the attachments folder.
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $mail_args : array<string|int, mixed>
- The email arguments.
- $mail_user : string
- The email user.
- $users : Users
- The instance of the common users class.
Methods
- get_instance() : object
- Creates and/or returns the instance of this class.
- send() : int|WP_Error
- Send email from site administrator.
- __construct() : void
- Initialise the class.
- set_attachments() : void
- Maybe set the attachment(s) argument.
- set_bcc_recipients() : void
- Maybe set the email bcc recipients.
- set_cc_recipients() : void
- Maybe set the email cc recipients.
- set_to_recipients() : void
- Set the email to recipients.
Constants
ATTACHMENTS_DIR
The attachments folder name.
protected
string
ATTACHMENTS_DIR
= 'attachments'
Tags
CAPABILITY
The user capability required to run this tool.
protected
string
CAPABILITY
= 'manage_options'
Tags
EXTENSION_WHITELIST
The the whitelist of attachment extensions.
protected
array<string|int, string>
EXTENSION_WHITELIST
= array('jpeg', 'jpg', 'pdf', 'pdf', 'png')
This lists the filename extensions that can be attached to an email.
Tags
Properties
$attachments_dir
The fully qualified path to the attachments folder.
protected
string
$attachments_dir
= ''
Tags
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$mail_args
The email arguments.
protected
array<string|int, mixed>
$mail_args
= array('to' => array(), 'cc' => array(), 'bcc' => array(), 'subject' => '', 'body' => '', 'headers' => array(), 'attachments' => array(), 'is_internal' => false)
The email arguments.
Tags
$mail_user
The email user.
protected
string
$mail_user
This is used to cc or bcc the email user.
Tags
$users
The instance of the common users class.
protected
Users
$users
Tags
Methods
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
send()
Send email from site administrator.
public
send(WP_Error $errors, array<string|int, string> $post_vars[, array<string|int, string> $files_vars = array() ]) : int|WP_Error
Parameters
- $errors : WP_Error
-
The WP_Error object to use if errors.
- $post_vars : array<string|int, string>
-
The sanitised $_POST arguments.
- $files_vars : array<string|int, string> = array()
-
The sanitised $_FILES arguments.
Tags
Return values
int|WP_Error —The number of emails sent or WP_Error object.
__construct()
Initialise the class.
protected
__construct() : void
Tags
set_attachments()
Maybe set the attachment(s) argument.
protected
set_attachments(array<string|int, mixed> $files_vars) : void
Parameters
- $files_vars : array<string|int, mixed>
-
The sanitised $_FILES arguments.
Tags
set_bcc_recipients()
Maybe set the email bcc recipients.
protected
set_bcc_recipients(array<string|int, string> $post_vars) : void
Parameters
- $post_vars : array<string|int, string>
-
The sanitised $_POST arguments.
Tags
set_cc_recipients()
Maybe set the email cc recipients.
protected
set_cc_recipients(array<string|int, string> $post_vars) : void
Parameters
- $post_vars : array<string|int, string>
-
The sanitised $_POST arguments.
Tags
set_to_recipients()
Set the email to recipients.
protected
set_to_recipients(array<string|int, string> $post_vars) : void
Parameters
- $post_vars : array<string|int, string>
-
The sanitised $_POST arguments.