<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 4.3.2 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
/**
* CodeIgniter Email Class
*
* Permits email to be sent using Mail, Sendmail, or SMTP.
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/libraries/email.html
*/
class CI_Email {
var $useragent = "CodeIgniter";
var $mailpath = "/usr/sbin/sendmail"; // Sendmail path
var $protocol = "mail"; // mail/sendmail/smtp
var $smtp_host = ""; // SMTP Server. Example: mail.earthlink.net
var $smtp_user = ""; // SMTP Username
var $smtp_pass = ""; // SMTP Password
var $smtp_port = "25"; // SMTP Port
var $smtp_timeout = 5; // SMTP Timeout in seconds
var $wordwrap = TRUE; // TRUE/FALSE Turns word-wrap on/off
var $wrapchars = "76"; // Number of characters to wrap at.
var $mailtype = "text"; // text/html Defines email formatting
var $charset = "utf-8"; // Default char set: iso-8859-1 or us-ascii
var $multipart = "mixed"; // "mixed" (in the body) or "related" (separate)
var $alt_message = ''; // Alternative message for HTML emails
var $validate = FALSE; // TRUE/FALSE. Enables email validation
var $priority = "3"; // Default priority (1 - 5)
var $newline = "\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822)
var $crlf = "\n"; // The RFC 2045 compliant CRLF for quoted-printable is "\r\n". Apparently some servers,
// even on the receiving end think they need to muck with CRLFs, so using "\n", while
// distasteful, is the only thing that seems to work for all environments.
var $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override. Set to FALSE for Yahoo.
var $bcc_batch_mode = FALSE; // TRUE/FALSE Turns on/off Bcc batch feature
var $bcc_batch_size = 200; // If bcc_batch_mode = TRUE, sets max number of Bccs in each batch
var $_safe_mode = FALSE;
var $_subject = "";
var $_body = "";
var $_finalbody = "";
var $_alt_boundary = "";
var $_atc_boundary = "";
var $_header_str = "";
var $_smtp_connect = "";
var $_encoding = "8bit";
var $_IP = FALSE;
var $_smtp_auth = FALSE;
var $_replyto_flag = FALSE;
var $_debug_msg = array();
var $_recipients = array();
var $_cc_array = array();
var $_bcc_array = array();
var $_headers = array();
var $_attach_name = array();
var $_attach_type = array();
var $_attach_disp = array();
var $_protocols = array('mail', 'sendmail', 'smtp');
var $_base_charsets = array('us-ascii', 'iso-2022-'); // 7-bit charsets (excluding language suffix)
var $_bit_depths = array('7bit', '8bit');
var $_priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)');
/**
* Constructor - Sets Email Preferences
*
* The constructor can be passed an array of config values
*/
function CI_Email($config = array())
{
if (count($config) > 0)
{
$this->initialize($config);
}
else
{
$this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE;
$this->_safe_mode = ((boolean)@ini_get("safe_mode") === FALSE) ? FALSE : TRUE;
}
log_message('debug', "Email Class Initialized");
}
// --------------------------------------------------------------------
/**
* Initialize preferences
*
* @access public
* @param array
* @return void
*/
function initialize($config = array())
{
$this->clear();
foreach ($config as $key => $val)
{
if (isset($this->$key))
{
$method = 'set_'.$key;
if (method_exists($this, $method))
{
$this->$method($val);
}
else
{
$this->$key = $val;
}
}
}
$this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE;
$this->_safe_mode = ((boolean)@ini_get("safe_mode") === FALSE) ? FALSE : TRUE;
}
// --------------------------------------------------------------------
/**
* Initialize the Email Data
*
* @access public
* @return void
*/
function clear($clear_attachments = FALSE)
{
$this->_subject = "";
$this->_body = "";
$this->_finalbody = "";
$this->_header_str = "";
$this->_replyto_flag = FALSE;
$this->_recipients = array();
$this->_headers = array();
$this->_debug_msg = array();
$this->_set_header('User-Agent', $this->useragent);
$this->_set_header('Date', $this->_set_date());
if ($clear_attachments !== FALSE)
{
$this->_attach_name = array();
$this->_attach_type = array();
$this->_attach_disp = array();
}
}
// --------------------------------------------------------------------
/**
* Set FROM
*
* @access public
* @param string
* @param string
* @return void
*/
function from($from, $name = '')
{
if (preg_match( '/\<(.*)\>/', $from, $match))
{
$from = $match['1'];
}
if ($this->validate)
{
$this->validate_email($this->_str_to_array($from));
}
if ($name != '' && strncmp($name, '"', 1) != 0)
{
$name = '"'.$name.'"';
}
$this->_set_header('From', $name.' <'.$from.'>');
$this->_set_header('Return-Path', '<'.$from.'>');
}
// --------------------------------------------------------------------
/**
* Set Reply-to
*
* @access public
* @param string
* @param string
* @return void
*/
function reply_to($replyto, $name = '')
{
if (preg_match( '/\<(.*)\>/', $replyto, $match))
{
$replyto = $match['1'];
}
if ($this->validate)
{
$this->validate_email($this->_str_to_array($replyto));
}
if ($name == '')
{
$name = $replyto;
}
if (strncmp($name, '"', 1) != 0)
{
$name = '"'.$name.'"';
}
$this->_set_header('Reply-To', $name.' <'.$replyto.'>');
$this->_replyto_flag = TRUE;
}
// --------------------------------------------------------------------
/**
* Set Recipients
*
* @access public
* @param string
* @return void
*/
function to($to)
{
$to = $this->_str_to_array($to);
$to = $this->clean_email($to);
if ($this->validate)
{
$this->validate_email($to);
}
if ($this->_get_protocol() != 'mail')
{
$this->_set_header('To', implode(", ", $to));
}
switch ($this->_get_protocol())
{
case 'smtp' : $this->_recipients = $to;
break;
case 'sendmail' : $this->_recipients = implode(", ", $to);
break;
case 'mail' : $this->_recipients = implode(", ", $to);
break;
}
}
// --------------------------------------------------------------------
/**
* Set CC
*
* @access public
* @param string
* @return void
*/
function cc($cc)
{
$cc = $this->_str_to_array($cc);
$cc = $this->clean_email($cc);
if ($this->validate)
{
$this->validate_email($cc);
}
$this->_set_header('Cc', implode(", ", $cc));
if ($this->_get_protocol() == "smtp")
{
$this->_cc_array = $cc;
}
}
// --------------------------------------------------------------------
/**
* Set BCC
*
* @access public
* @param string
* @param string
* @return void
*/
function bcc($bcc, $limit = '')
{
if ($limit != '' && is_numeric($limit))
{
$this->bcc_batch_mode = TRUE;
$this->bcc_batch_size = $limit;
}
$bcc = $this->_str_to_array($bcc);
$bcc = $this
没有合适的资源?快使用搜索试试~ 我知道了~
ci案例ci案例ci案例ci案例
共1029个文件
php:365个
gif:331个
html:184个
3星 · 超过75%的资源 需积分: 10 60 下载量 185 浏览量
2009-09-01
09:03:08
上传
评论 1
收藏 3.01MB RAR 举报
温馨提示
ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例ci案例
资源推荐
资源详情
资源评论
收起资源包目录
ci案例ci案例ci案例ci案例 (1029个子文件)
COPYING 18KB
ext-all.css 70KB
ytheme-aero.css 15KB
flexigrid.css 15KB
ytheme-vista.css 14KB
ytheme-gray.css 12KB
form.css 7KB
userguide.css 7KB
grid.css 7KB
basic-dialog.css 6KB
layout.css 6KB
core.css 5KB
panel.css 5KB
tree.css 5KB
toolbar.css 5KB
flora.datepicker.css 4KB
chilli-recipes.css 4KB
simpletree.css 4KB
resizable.css 4KB
window.css 3KB
button.css 3KB
date-picker.css 3KB
flora.tabs.css 3KB
tabs.css 3KB
qtips.css 3KB
box.css 3KB
menu.css 2KB
stylesheet.css 2KB
main.css 2KB
stylesheet.css 2KB
dd.css 1KB
debug.css 1KB
main.css 1KB
combo.css 1KB
menus.css 817B
divlocation.css 705B
loading.css 627B
reset-min.css 477B
style.css 438B
Thumbs.db 33KB
Thumbs.db 25KB
Thumbs.db 21KB
Thumbs.db 18KB
install.doc 632B
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
dlg-bg.gif 27KB
dlg-bg.gif 27KB
appflowchart.gif 25KB
progress.gif 19KB
progress2.gif 14KB
error-tip-corners.gif 4KB
tip-sprite.gif 4KB
._fhbg.gif 4KB
._wbg.gif 4KB
tip-sprite.gif 4KB
tip-sprite.gif 4KB
tab-sprite.gif 3KB
tab-sprite.gif 3KB
tab-sprite.gif 3KB
tab-sprite.gif 3KB
load.gif 2KB
collapse-bg.gif 2KB
tab-btm-inactive-right-bg.gif 2KB
tab-btm-inactive-right-bg.gif 2KB
tab-btm-right-bg.gif 2KB
tab-btm-right-bg.gif 2KB
tab-btm-right-bg.gif 2KB
tab-btm-right-bg.gif 2KB
tab-btm-inactive-right-bg.gif 2KB
tab-btm-inactive-right-bg.gif 2KB
e-handle.gif 2KB
e-handle.gif 2KB
e-handle.gif 2KB
e-handle.gif 2KB
spinner.gif 2KB
expandable.gif 2KB
collapsable.gif 1KB
gradient-bg.gif 1KB
gradient-bg.gif 1KB
gradient-bg.gif 1KB
gradient-bg.gif 1KB
gradient-bg.gif 1KB
leaf.gif 1KB
btn-sprite.gif 1KB
s-handle.gif 1KB
s-handle.gif 1KB
s-handle.gif 1KB
s-handle.gif 1KB
trigger.gif 1KB
bg-right.gif 1KB
gradient-bg.gif 1KB
gradient-bg.gif 1KB
gradient-bg.gif 1KB
bg-left.gif 1KB
smile.gif 1KB
tb-btn-sprite.gif 1KB
tb-btn-sprite.gif 1KB
共 1029 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
- L78糟2014-09-03还行,版本有点久。不过可以学习使用
jiangtiansheji
- 粉丝: 1
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功