PHP 클래스 CI_Email, TastyIgniter

Permits email to be sent using Mail, Sendmail, or SMTP.
저자: EllisLab Dev Team
파일 보기 프로젝트 열기: tastyigniter/tastyigniter 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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.

보호된 프로퍼티들

프로퍼티 타입 설명
$_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