\CI_Email

CodeIgniter Email Class

Permits email to be sent using Mail, Sendmail, or SMTP.

Summary

Methods
Properties
Constants
__construct()
initialize()
clear()
from()
reply_to()
to()
cc()
bcc()
subject()
message()
attach()
set_alt_message()
set_mailtype()
set_wordwrap()
set_protocol()
set_priority()
set_newline()
set_crlf()
validate_email()
valid_email()
clean_email()
word_wrap()
send()
batch_bcc_send()
print_debugger()
$useragent
$mailpath
$protocol
$smtp_host
$smtp_user
$smtp_pass
$smtp_port
$smtp_timeout
$smtp_crypto
$wordwrap
$wrapchars
$mailtype
$charset
$multipart
$alt_message
$validate
$priority
$newline
$crlf
$send_multipart
$bcc_batch_mode
$bcc_batch_size
$_safe_mode
$_subject
$_body
$_finalbody
$_alt_boundary
$_atc_boundary
$_header_str
$_smtp_connect
$_encoding
$_IP
$_smtp_auth
$_replyto_flag
$_debug_msg
$_recipients
$_cc_array
$_bcc_array
$_headers
$_attach_name
$_attach_type
$_attach_disp
$_protocols
$_base_charsets
$_bit_depths
$_priorities
No constants found
_set_header()
_str_to_array()
_set_boundaries()
_get_message_id()
_get_protocol()
_get_encoding()
_get_content_type()
_set_date()
_get_mime_message()
_get_alt_message()
_build_headers()
_write_headers()
_build_message()
_prep_quoted_printable()
_prep_q_encoding()
_unwrap_specials()
_remove_nl_callback()
_spool_email()
_send_with_mail()
_send_with_sendmail()
_send_with_smtp()
_smtp_connect()
_send_command()
_smtp_authenticate()
_send_data()
_get_smtp_data()
_get_hostname()
_get_ip()
_set_error_message()
_mime_types()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$useragent

$useragent : 

Type

$mailpath

$mailpath : 

Type

$protocol

$protocol : 

Type

$smtp_host

$smtp_host : 

Type

$smtp_user

$smtp_user : 

Type

$smtp_pass

$smtp_pass : 

Type

$smtp_port

$smtp_port : 

Type

$smtp_timeout

$smtp_timeout : 

Type

$smtp_crypto

$smtp_crypto : 

Type

$wordwrap

$wordwrap : 

Type

$wrapchars

$wrapchars : 

Type

$mailtype

$mailtype : 

Type

$charset

$charset : 

Type

$multipart

$multipart : 

Type

$alt_message

$alt_message : 

Type

$validate

$validate : 

Type

$priority

$priority : 

Type

$newline

$newline : 

Type

$crlf

$crlf : 

Type

$send_multipart

$send_multipart : 

Type

$bcc_batch_mode

$bcc_batch_mode : 

Type

$bcc_batch_size

$bcc_batch_size : 

Type

$_safe_mode

$_safe_mode : 

Type

$_subject

$_subject : 

Type

$_body

$_body : 

Type

$_finalbody

$_finalbody : 

Type

$_alt_boundary

$_alt_boundary : 

Type

$_atc_boundary

$_atc_boundary : 

Type

$_header_str

$_header_str : 

Type

$_smtp_connect

$_smtp_connect : 

Type

$_encoding

$_encoding : 

Type

$_IP

$_IP : 

Type

$_smtp_auth

$_smtp_auth : 

Type

$_replyto_flag

$_replyto_flag : 

Type

$_debug_msg

$_debug_msg : 

Type

$_recipients

$_recipients : 

Type

$_cc_array

$_cc_array : 

Type

$_bcc_array

$_bcc_array : 

Type

$_headers

$_headers : 

Type

$_attach_name

$_attach_name : 

Type

$_attach_type

$_attach_type : 

Type

$_attach_disp

$_attach_disp : 

Type

$_protocols

$_protocols : 

Type

$_base_charsets

$_base_charsets : 

Type

$_bit_depths

$_bit_depths : 

Type

$_priorities

$_priorities : 

Type

Methods

__construct()

__construct(  $config = array()) 

Constructor - Sets Email Preferences

The constructor can be passed an array of config values

Parameters

$config

initialize()

initialize(  $config = array()) : void

Initialize preferences

Parameters

$config

clear()

clear(  $clear_attachments = FALSE) : void

Initialize the Email Data

Parameters

$clear_attachments

from()

from(  $from,   $name = '') : void

Set FROM

Parameters

$from
$name

reply_to()

reply_to(  $replyto,   $name = '') : void

Set Reply-to

Parameters

$replyto
$name

to()

to(  $to) : void

Set Recipients

Parameters

$to

cc()

cc(  $cc) : void

Set CC

Parameters

$cc

bcc()

bcc(  $bcc,   $limit = '') : void

Set BCC

Parameters

$bcc
$limit

subject()

subject(  $subject) : void

Set Email Subject

Parameters

$subject

message()

message(  $body) : void

Set Body

Parameters

$body

attach()

attach(  $filename,   $disposition = 'attachment') : void

Assign file attachments

Parameters

$filename
$disposition

set_alt_message()

set_alt_message(  $str = '') : void

Set Multipart Value

Parameters

$str

set_mailtype()

set_mailtype(  $type = 'text') : void

Set Mailtype

Parameters

$type

set_wordwrap()

set_wordwrap(  $wordwrap = TRUE) : void

Set Wordwrap

Parameters

$wordwrap

set_protocol()

set_protocol(  $protocol = 'mail') : void

Set Protocol

Parameters

$protocol

set_priority()

set_priority(  $n = 3) : void

Set Priority

Parameters

$n

set_newline()

set_newline(  $newline = "\n") : void

Set Newline Character

Parameters

$newline

set_crlf()

set_crlf(  $crlf = "\n") : void

Set CRLF

Parameters

$crlf

validate_email()

validate_email(  $email) : boolean

Validate Email Address

Parameters

$email

Returns

boolean

valid_email()

valid_email(  $address) : boolean

Email Validation

Parameters

$address

Returns

boolean

clean_email()

clean_email(  $email) : string

Clean Extended Email Address: Joe Smith <joe@smith.com>

Parameters

$email

Returns

string

word_wrap()

word_wrap(  $str,   $charlim = '') : string

Word Wrap

Parameters

$str
$charlim

Returns

string

send()

send() : boolean

Send Email

Returns

boolean

batch_bcc_send()

batch_bcc_send() : boolean

Batch Bcc Send. Sends groups of BCCs in batches

Returns

boolean

print_debugger()

print_debugger() : string

Get Debug Message

Returns

string

_set_header()

_set_header(  $header,   $value) : void

Add a Header Item

Parameters

$header
$value

_str_to_array()

_str_to_array(  $email) : array

Convert a String to an Array

Parameters

$email

Returns

array

_set_boundaries()

_set_boundaries() : void

Set Message Boundary

_get_message_id()

_get_message_id() : string

Get the Message ID

Returns

string

_get_protocol()

_get_protocol(  $return = TRUE) : string

Get Mail Protocol

Parameters

$return

Returns

string

_get_encoding()

_get_encoding(  $return = TRUE) : string

Get Mail Encoding

Parameters

$return

Returns

string

_get_content_type()

_get_content_type() : string

Get content type (text/html/attachment)

Returns

string

_set_date()

_set_date() : string

Set RFC 822 Date

Returns

string

_get_mime_message()

_get_mime_message() : string

Mime message

Returns

string

_get_alt_message()

_get_alt_message() : string

Build alternative plain text message

This public function 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

Returns

string

_build_headers()

_build_headers() : string

Build final headers

Returns

string

_write_headers()

_write_headers() : void

Write Headers as a string

_build_message()

_build_message() : void

Build Final Body and attachments

_prep_quoted_printable()

_prep_quoted_printable(  $str,   $charlim = '') : string

Prep Quoted Printable

Prepares string for Quoted-Printable Content-Transfer-Encoding Refer to RFC 2045 http://www.ietf.org/rfc/rfc2045.txt

Parameters

$str
$charlim

Returns

string

_prep_q_encoding()

_prep_q_encoding(  $str,   $from = FALSE) : \str

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

Parameters

$str
$from

Returns

\str

_unwrap_specials()

_unwrap_specials() : void

Unwrap special elements

_remove_nl_callback()

_remove_nl_callback(  $matches) : string

Strip line-breaks via callback

Parameters

$matches

Returns

string

_spool_email()

_spool_email() : boolean

Spool mail to the mail server

Returns

boolean

_send_with_mail()

_send_with_mail() : boolean

Send using mail()

Returns

boolean

_send_with_sendmail()

_send_with_sendmail() : boolean

Send using Sendmail

Returns

boolean

_send_with_smtp()

_send_with_smtp() : boolean

Send using SMTP

Returns

boolean

_smtp_connect()

_smtp_connect() : string

SMTP Connect

Returns

string

_send_command()

_send_command(  $cmd,   $data = '') : string

Send SMTP command

Parameters

$cmd
$data

Returns

string

_smtp_authenticate()

_smtp_authenticate() : boolean

SMTP Authenticate

Returns

boolean

_send_data()

_send_data(  $data) : boolean

Send SMTP data

Parameters

$data

Returns

boolean

_get_smtp_data()

_get_smtp_data() : string

Get SMTP data

Returns

string

_get_hostname()

_get_hostname() : string

Get Hostname

Returns

string

_get_ip()

_get_ip() : string

Get IP

Returns

string

_set_error_message()

_set_error_message(  $msg,   $val = '') : string

Set Message

Parameters

$msg
$val

Returns

string

_mime_types()

_mime_types(  $ext = "") : string

Mime Types

Parameters

$ext

Returns

string