pfeifferNet

Send_Email
in package

Send email from pNet admin tools page.

  • Send HTML email.
Tags
since
5.3.0
since
5.5.0

Inherit standard singleton class.

since
5.11.0

Deprecated global singleton.

since
5.11.0

Use AJAX submission.

since
6.0.0

Separate form handling and email handling.

used-by
Form_Send_Email
used-by
Form_Send_Email::__construct()

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
since
5.8.0

CAPABILITY

The user capability required to run this tool.

protected string CAPABILITY = 'manage_options'
Tags
since
5.10.0

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
since
5.11.0

Properties

$attachments_dir

The fully qualified path to the attachments folder.

protected string $attachments_dir = ''
Tags
since
5.8.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
5.11.0

$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
since
5.5.0
see
HTML_Email::MAIL_DEFAULTS

$mail_user

The email user.

protected string $mail_user

This is used to cc or bcc the email user.

Tags
since
5.8.0

Methods

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
5.11.0
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
since
5.5.0
uses
HTML_Email::send()
used-by
Form_Send_Email::handle_ajax_request()
Return values
int|WP_Error

The number of emails sent or WP_Error object.

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
since
5.5.0
since
5.11.0

Limit the types of files that cab be attached.

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
since
6.0.0
uses
Users::get_by_role()

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
since
6.0.0
uses
Users::get_by_role()

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.

Tags
since
6.0.0
uses
Users::get_by_role()

        
On this page

Search results