PHP Класс CI_Email, TastyIgniter

Permits email to be sent using Mail, Sendmail, or SMTP.
Автор: EllisLab Dev Team
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$alt_message string Alternative message (for HTML messages only)
$bcc_batch_mode boolean Whether to send messages to BCC recipients in batches.
$bcc_batch_size integer BCC Batch max number size.
$charset string Character set (default: utf-8)
$crlf string RFC 2045 specifies that for 'quoted-printable' encoding, "\r\n" must be used. However, it appears that some servers (even on the receiving end) don't handle it properly and switching to "\n", while improper, is the only solution that seems to work for all environments.
$dsn boolean Whether to use Delivery Status Notification.
$mailpath string Path to the Sendmail binary.
$mailtype Message format.
$multipart Multipart message
$newline Use "\r\n" to comply with RFC 822.
$priority X-Priority header value.
$protocol Which method to use for sending e-mails.
$send_multipart boolean Yahoo! doesn't seem to like these.
$smtp_crypto SMTP Encryption
$smtp_host string STMP Server host
$smtp_keepalive boolean SMTP persistent connection
$smtp_pass string SMTP Password
$smtp_port integer SMTP Server port
$smtp_timeout integer SMTP connection timeout in seconds
$smtp_user string SMTP Username
$useragent string Used as the User-Agent and X-Mailer headers' value.
$validate boolean Whether to validate e-mail addresses.
$wordwrap boolean Whether to apply word-wrapping to the message body.
$wrapchars integer Number of characters to wrap at.

Защищенные свойства (Protected)

Свойство Тип Описание
$_alt_boundary string multipart/alternative boundary
$_atc_boundary string Attachment boundary
$_attachments array Attachment data
$_base_charsets string[] Character sets valid for 7-bit encoding, excluding language suffix.
$_bcc_array string[] BCC Recipients
$_bit_depths string[] Valid mail encodings
$_body string Message body
$_cc_array string[] CC Recipients
$_debug_msg string Debug messages
$_encoding Mail encoding
$_finalbody string Final message body to be sent.
$_header_str string Final headers to send
$_headers string[] Message headers
$_priorities string[] Actual values to send with the X-Priority header
$_protocols string[] Valid $protocol values
$_recipients string[] Recipients
$_replyto_flag boolean Whether to send a Reply-To header
$_safe_mode boolean Whether PHP is running in safe mode. Initialized by the class constructor.
$_smtp_auth boolean Whether to perform SMTP authentication
$_smtp_connect resource SMTP Connection socket placeholder
$_subject string Subject header

Открытые методы

Метод Описание
__construct ( array $config = [] ) : void Constructor - Sets Email Preferences
__destruct ( ) : void Destructor - Releases Resources
attach ( string $file, string $disposition = '', string $newname = NULL, string $mime = '' ) : CI_Email Assign file attachments
attachment_cid ( string $filename ) : string Set and return attachment Content-ID
batch_bcc_send ( ) : void Batch Bcc Send. Sends groups of BCCs in batches
bcc ( $bcc, $limit = '' ) : CI_Email Set BCC
cc ( $cc ) : CI_Email Set CC
clean_email ( $email ) : string Clean Extended Email Address: Joe Smith
clear ( $clear_attachments = FALSE ) : CI_Email Initialize the Email Data
from ( string $from, string $name = '', string $return_path = NULL ) : CI_Email Set FROM
initialize ( $config = [] ) : CI_Email Initialize preferences
message ( $body ) : CI_Email Set Body
print_debugger ( array $include = ['headers', 'subject', 'body'] ) : string Get Debug Message
reply_to ( $replyto, $name = '' ) : CI_Email Set Reply-to
send ( boolean $auto_clear = TRUE ) : boolean Send Email
set_alt_message ( $str ) : CI_Email Set Multipart Value
set_crlf ( $crlf = " " ) : CI_Email Set CRLF
set_header ( $header, $value ) : CI_Email Add a Header Item
set_mailtype ( $type = 'text' ) : CI_Email Set Mailtype
set_newline ( $newline = " " ) : CI_Email Set Newline Character
set_priority ( $n = 3 ) : CI_Email Set Priority
set_protocol ( $protocol = 'mail' ) : CI_Email Set Protocol
set_wordwrap ( $wordwrap = TRUE ) : CI_Email Set Wordwrap
subject ( $subject ) : CI_Email Set Email Subject
to ( $to ) : CI_Email Set Recipients
valid_email ( $email ) : boolean Email Validation
validate_email ( $email ) : boolean Validate Email Address
word_wrap ( $str, $charlim = NULL ) : string Word Wrap

Защищенные методы

Метод Описание
_build_headers ( ) : string Build final headers
_build_message ( ) : boolean Build Final Body and attachments
_get_alt_message ( ) : string Build alternative plain text message
_get_content_type ( ) : string Get content type (text/html/attachment)
_get_encoding ( $return = TRUE ) : string Get Mail Encoding
_get_hostname ( ) : string Get Hostname
_get_message_id ( ) : string Get the Message ID
_get_mime_message ( ) : string Mime message
_get_protocol ( $return = TRUE ) : mixed Get Mail Protocol
_get_smtp_data ( ) : string Get SMTP data
_mime_types ( $ext = '' ) : string Mime Types
_prep_q_encoding ( $str ) : string Prep Q Encoding
_prep_quoted_printable ( $str ) : string Prep Quoted Printable
_remove_nl_callback ( string $matches ) : string Strip line-breaks via callback
_send_command ( $cmd, $data = '' ) : string Send SMTP command
_send_data ( string $data ) : boolean Send SMTP data
_send_with_mail ( ) : boolean Send using mail()
_send_with_sendmail ( ) : boolean Send using Sendmail
_send_with_smtp ( ) : boolean Send using SMTP
_set_boundaries ( ) : void Set Message Boundary
_set_date ( ) : string Set RFC 822 Date
_set_error_message ( string $msg, string $val = '' ) : void Set Message
_smtp_authenticate ( ) : boolean SMTP Authenticate
_smtp_connect ( ) : string SMTP Connect
_spool_email ( ) : boolean Spool mail to the mail server
_str_to_array ( $email ) : array Convert a String to an Array
_unwrap_specials ( ) : void Unwrap special elements
_write_headers ( ) : void Write Headers as a string

Описание методов

__construct() публичный Метод

The constructor can be passed an array of config values
public __construct ( array $config = [] ) : void
$config array = array()
Результат void

__destruct() публичный Метод

Destructor - Releases Resources
public __destruct ( ) : void
Результат void

_build_headers() защищенный Метод

Build final headers
protected _build_headers ( ) : string
Результат string

_build_message() защищенный Метод

Build Final Body and attachments
protected _build_message ( ) : boolean
Результат boolean

_get_alt_message() защищенный Метод

Provides the raw message for use in plain-text headers of HTML-formatted emails. If the user hasn't specified his own alternative message it creates one by stripping the HTML
protected _get_alt_message ( ) : string
Результат string

_get_content_type() защищенный Метод

Get content type (text/html/attachment)
protected _get_content_type ( ) : string
Результат string

_get_encoding() защищенный Метод

Get Mail Encoding
protected _get_encoding ( $return = TRUE ) : string
Результат string

_get_hostname() защищенный Метод

There are only two legal types of hostname - either a fully qualified domain name (eg: "mail.example.com") or an IP literal (eg: "[1.2.3.4]").
protected _get_hostname ( ) : string
Результат string

_get_message_id() защищенный Метод

Get the Message ID
protected _get_message_id ( ) : string
Результат string

_get_mime_message() защищенный Метод

Mime message
protected _get_mime_message ( ) : string
Результат string

_get_protocol() защищенный Метод

Get Mail Protocol
protected _get_protocol ( $return = TRUE ) : mixed
Результат mixed

_get_smtp_data() защищенный Метод

Get SMTP data
protected _get_smtp_data ( ) : string
Результат string

_mime_types() защищенный Метод

Mime Types
protected _mime_types ( $ext = '' ) : string
Результат string

_prep_q_encoding() защищенный Метод

Performs "Q Encoding" on a string for use in email headers. It's related but not identical to quoted-printable, so it has its own method.
protected _prep_q_encoding ( $str ) : string
Результат string

_prep_quoted_printable() защищенный Метод

Prepares string for Quoted-Printable Content-Transfer-Encoding Refer to RFC 2045 http://www.ietf.org/rfc/rfc2045.txt
protected _prep_quoted_printable ( $str ) : string
Результат string

_remove_nl_callback() защищенный Метод

Strip line-breaks via callback
protected _remove_nl_callback ( string $matches ) : string
$matches string
Результат string

_send_command() защищенный Метод

Send SMTP command
protected _send_command ( $cmd, $data = '' ) : string
Результат string

_send_data() защищенный Метод

Send SMTP data
protected _send_data ( string $data ) : boolean
$data string
Результат boolean

_send_with_mail() защищенный Метод

Send using mail()
protected _send_with_mail ( ) : boolean
Результат boolean

_send_with_sendmail() защищенный Метод

Send using Sendmail
protected _send_with_sendmail ( ) : boolean
Результат boolean

_send_with_smtp() защищенный Метод

Send using SMTP
protected _send_with_smtp ( ) : boolean
Результат boolean

_set_boundaries() защищенный Метод

Set Message Boundary
protected _set_boundaries ( ) : void
Результат void

_set_date() защищенный Метод

Set RFC 822 Date
protected _set_date ( ) : string
Результат string

_set_error_message() защищенный Метод

Set Message
protected _set_error_message ( string $msg, string $val = '' ) : void
$msg string
$val string = ''
Результат void

_smtp_authenticate() защищенный Метод

SMTP Authenticate
protected _smtp_authenticate ( ) : boolean
Результат boolean

_smtp_connect() защищенный Метод

SMTP Connect
protected _smtp_connect ( ) : string
Результат string

_spool_email() защищенный Метод

Spool mail to the mail server
protected _spool_email ( ) : boolean
Результат boolean

_str_to_array() защищенный Метод

Convert a String to an Array
protected _str_to_array ( $email ) : array
Результат array

_unwrap_specials() защищенный Метод

Unwrap special elements
protected _unwrap_specials ( ) : void
Результат void

_write_headers() защищенный Метод

Write Headers as a string
protected _write_headers ( ) : void
Результат void

attach() публичный Метод

Assign file attachments
public attach ( string $file, string $disposition = '', string $newname = NULL, string $mime = '' ) : CI_Email
$file string Can be local path, URL or buffered content
$disposition string = 'attachment'
$newname string = NULL
$mime string = ''
Результат CI_Email

attachment_cid() публичный Метод

Useful for attached inline pictures
public attachment_cid ( string $filename ) : string
$filename string
Результат string

batch_bcc_send() публичный Метод

Batch Bcc Send. Sends groups of BCCs in batches
public batch_bcc_send ( ) : void
Результат void

bcc() публичный Метод

Set BCC
public bcc ( $bcc, $limit = '' ) : CI_Email
Результат CI_Email

cc() публичный Метод

Set CC
public cc ( $cc ) : CI_Email
Результат CI_Email

clean_email() публичный Метод

Clean Extended Email Address: Joe Smith
public clean_email ( $email ) : string
Результат string

clear() публичный Метод

Initialize the Email Data
public clear ( $clear_attachments = FALSE ) : CI_Email
Результат CI_Email

from() публичный Метод

Set FROM
public from ( string $from, string $name = '', string $return_path = NULL ) : CI_Email
$from string
$name string
$return_path string = NULL Return-Path
Результат CI_Email

initialize() публичный Метод

Initialize preferences
public initialize ( $config = [] ) : CI_Email
Результат CI_Email

message() публичный Метод

Set Body
public message ( $body ) : CI_Email
Результат CI_Email

print_debugger() публичный Метод

Get Debug Message
public print_debugger ( array $include = ['headers', 'subject', 'body'] ) : string
$include array List of raw data chunks to include in the output Valid options are: 'headers', 'subject', 'body'
Результат string

reply_to() публичный Метод

Set Reply-to
public reply_to ( $replyto, $name = '' ) : CI_Email
Результат CI_Email

send() публичный Метод

Send Email
public send ( boolean $auto_clear = TRUE ) : boolean
$auto_clear boolean = TRUE
Результат boolean

set_alt_message() публичный Метод

Set Multipart Value
public set_alt_message ( $str ) : CI_Email
Результат CI_Email

set_crlf() публичный Метод

Set CRLF
public set_crlf ( $crlf = " " ) : CI_Email
Результат CI_Email

set_header() публичный Метод

Add a Header Item
public set_header ( $header, $value ) : CI_Email
Результат CI_Email

set_mailtype() публичный Метод

Set Mailtype
public set_mailtype ( $type = 'text' ) : CI_Email
Результат CI_Email

set_newline() публичный Метод

Set Newline Character
public set_newline ( $newline = " " ) : CI_Email
Результат CI_Email

set_priority() публичный Метод

Set Priority
public set_priority ( $n = 3 ) : CI_Email
Результат CI_Email

set_protocol() публичный Метод

Set Protocol
public set_protocol ( $protocol = 'mail' ) : CI_Email
Результат CI_Email

set_wordwrap() публичный Метод

Set Wordwrap
public set_wordwrap ( $wordwrap = TRUE ) : CI_Email
Результат CI_Email

subject() публичный Метод

Set Email Subject
public subject ( $subject ) : CI_Email
Результат CI_Email

to() публичный Метод

Set Recipients
public to ( $to ) : CI_Email
Результат CI_Email

valid_email() публичный Метод

Email Validation
public valid_email ( $email ) : boolean
Результат boolean

validate_email() публичный Метод

Validate Email Address
public validate_email ( $email ) : boolean
Результат boolean

word_wrap() публичный Метод

Word Wrap
public word_wrap ( $str, $charlim = NULL ) : string
Результат string

Описание свойств

$_alt_boundary защищенное свойство

multipart/alternative boundary
protected string $_alt_boundary
Результат string

$_atc_boundary защищенное свойство

Attachment boundary
protected string $_atc_boundary
Результат string

$_attachments защищенное свойство

Attachment data
protected array $_attachments
Результат array

$_base_charsets защищенное свойство

Character sets valid for 7-bit encoding, excluding language suffix.
protected string[] $_base_charsets
Результат string[]

$_bcc_array защищенное свойство

BCC Recipients
protected string[] $_bcc_array
Результат string[]

$_bit_depths защищенное свойство

Valid mail encodings
См. также: CI_Email::$_encoding
protected string[] $_bit_depths
Результат string[]

$_body защищенное свойство

Message body
protected string $_body
Результат string

$_cc_array защищенное свойство

CC Recipients
protected string[] $_cc_array
Результат string[]

$_debug_msg защищенное свойство

Debug messages
См. также: CI_Email::print_debugger()
protected string $_debug_msg
Результат string

$_encoding защищенное свойство

Mail encoding
protected $_encoding

$_finalbody защищенное свойство

Final message body to be sent.
protected string $_finalbody
Результат string

$_header_str защищенное свойство

Final headers to send
protected string $_header_str
Результат string

$_headers защищенное свойство

Message headers
protected string[] $_headers
Результат string[]

$_priorities защищенное свойство

Actual values to send with the X-Priority header
protected string[] $_priorities
Результат string[]

$_protocols защищенное свойство

Valid $protocol values
См. также: CI_Email::$protocol
protected string[] $_protocols
Результат string[]

$_recipients защищенное свойство

Recipients
protected string[] $_recipients
Результат string[]

$_replyto_flag защищенное свойство

Whether to send a Reply-To header
protected bool $_replyto_flag
Результат boolean

$_safe_mode защищенное свойство

Whether PHP is running in safe mode. Initialized by the class constructor.
protected bool $_safe_mode
Результат boolean

$_smtp_auth защищенное свойство

Whether to perform SMTP authentication
protected bool $_smtp_auth
Результат boolean

$_smtp_connect защищенное свойство

SMTP Connection socket placeholder
protected resource $_smtp_connect
Результат resource

$_subject защищенное свойство

Subject header
protected string $_subject
Результат string

$alt_message публичное свойство

Alternative message (for HTML messages only)
public string $alt_message
Результат string

$bcc_batch_mode публичное свойство

Whether to send messages to BCC recipients in batches.
public bool $bcc_batch_mode
Результат boolean

$bcc_batch_size публичное свойство

BCC Batch max number size.
См. также: CI_Email::$bcc_batch_mode
public int $bcc_batch_size
Результат integer

$charset публичное свойство

Character set (default: utf-8)
public string $charset
Результат string

$crlf публичное свойство

RFC 2045 specifies that for 'quoted-printable' encoding, "\r\n" must be used. However, it appears that some servers (even on the receiving end) don't handle it properly and switching to "\n", while improper, is the only solution that seems to work for all environments.
public string $crlf
Результат string

$dsn публичное свойство

Whether to use Delivery Status Notification.
public bool $dsn
Результат boolean

$mailpath публичное свойство

Path to the Sendmail binary.
public string $mailpath
Результат string

$mailtype публичное свойство

Message format.
public $mailtype

$multipart публичное свойство

Multipart message
public $multipart

$newline публичное свойство

Use "\r\n" to comply with RFC 822.
public $newline

$priority публичное свойство

X-Priority header value.
public $priority

$protocol публичное свойство

Which method to use for sending e-mails.
public $protocol

$send_multipart публичное свойство

Yahoo! doesn't seem to like these.
public bool $send_multipart
Результат boolean

$smtp_crypto публичное свойство

SMTP Encryption
public $smtp_crypto

$smtp_host публичное свойство

STMP Server host
public string $smtp_host
Результат string

$smtp_keepalive публичное свойство

SMTP persistent connection
public bool $smtp_keepalive
Результат boolean

$smtp_pass публичное свойство

SMTP Password
public string $smtp_pass
Результат string

$smtp_port публичное свойство

SMTP Server port
public int $smtp_port
Результат integer

$smtp_timeout публичное свойство

SMTP connection timeout in seconds
public int $smtp_timeout
Результат integer

$smtp_user публичное свойство

SMTP Username
public string $smtp_user
Результат string

$useragent публичное свойство

Used as the User-Agent and X-Mailer headers' value.
public string $useragent
Результат string

$validate публичное свойство

Whether to validate e-mail addresses.
public bool $validate
Результат boolean

$wordwrap публичное свойство

Whether to apply word-wrapping to the message body.
public bool $wordwrap
Результат boolean

$wrapchars публичное свойство

Number of characters to wrap at.
См. также: CI_Email::$wordwrap
public int $wrapchars
Результат integer