<?php
class Mail
{
private $charset = "UTF-8";
private $boundary = "";
private $SubBody = array();
private $body = array();
private $ctencoding = "base64";
private $count_body = 1;
private $checkAddress = true;
private $headers = array();
private $ready_headers = array();
private $names_email = array();
private $receipt = 0;
private $smtpsendto = array();
private $sendto = array();
private $acc = array();
private $abcc = array();
private $smtp = array();
private $smtp_log = '';
private $log_on = false;
private $body_header = array();
public $status_mail = array('status' => true, "message" => 'ок');
public function __construct($charset = "", $ctencoding = '')
{
$this->boundary = md5(uniqid("myboundary"));
$this->smtp['on'] = false;
if (strlen($ctencoding) and $ctencoding == '8bit')
{
$this->ctencoding = '8bit';
}
if (strlen($charset))
{
$this->charset = strtolower($charset);
if ($this->charset == "us-ascii")
{
$this->ctencoding = "7bit";
}
}
}
public function Body($text, $text_html = "", $alternative_text = '', $resource = 'webi')
{
if (!strlen($resource))
$resource = 'webi';
if ($text_html == "html")
$text_html = "text/html";
else
$text_html = "text/plain";
if ($this->ctencoding == 'base64')
{
if (strlen($alternative_text))
$alternative_text = chunk_split(base64_encode($alternative_text));
if (strlen($text))
$text = chunk_split(base64_encode($text));
}
if (!strlen($alternative_text))
{
$body = "Content-Type: ".$text_html."; charset=".$this->charset."\r\n";
$body.="Content-Transfer-Encoding: ".$this->ctencoding."\r\n\r\n";
$body.=$text;
}
elseif (strlen($alternative_text) and $text_html == 'text/html')
{
$body = "Content-Type: multipart/alternative; boundary=ALT-".$this->boundary."\r\n\r\n";
$body.="--ALT-".$this->boundary."\r\n";
$body.="Content-Type: text/plain; charset=".$this->charset."\r\n";
$body.="Content-Transfer-Encoding: ".$this->ctencoding."\r\n\r\n";
$body.=$alternative_text."\r\n";
$body.="--ALT-".$this->boundary."\r\n";
$body.="Content-Type: text/html; charset=".$this->charset."\r\n";
$body.="Content-Transfer-Encoding: ".$this->ctencoding."\r\n\r\n";
$body.=$text."\r\n";
$body.="--ALT-".$this->boundary."--";
}
$this->SubBody[$resource]['body'][0] = $body;
}
protected function mime_content_type($file)
{
$ext = strtolower(substr(strrchr(basename($file), '.'), 1));
switch ($ext)
{
case 'jpg': return 'image/jpeg';
case 'jpeg': return 'image/jpeg';
case 'gif': return 'image/gif';
case 'png': return 'image/png';
case 'ico': return 'image/x-icon';
case 'txt': return 'text/plain';
default: return 'application/octet-stream';
}
}
public function Attach($filename, $new_name_filename = "", $filetype = "", $disposition = "", $resource = 'webi')
{
if (!strlen($resource))
$resource = 'webi';
if (!file_exists($filename))
{
return FALSE;
}
if (strlen($new_name_filename))
$basename = basename($new_name_filename);
else
$basename = basename($filename);
$charset_name = "=?".$this->charset."?B?".base64_encode($basename)."?=";
if (!strlen($filetype))
$filetype = $this->mime_content_type($basename);
$body = "Content-Type: ".$filetype."; name=\"$charset_name\"\r\n";
$body.="Content-Transfer-Encoding: base64\r\n";
if ($disposition == 'attachment')
{
$body.="Content-Disposition: attachment; filename=\"$charset_name\"\r\n";
}
$body.="Content-ID: <".$basename.">\r\n";
$body.="\r\n";
$body.=chunk_split(base64_encode(file_get_contents($filename)));
if ($disposition == 'attachment')
$this->SubBody[$resource]['mixed'][] = $body;
else
{
$this->SubBody[$resource]['body'][$this->count_body] = $body;
$this->count_body++;
}
}
public function BuildMail($resource = 'webi')
{
if (!strlen($resource))
$resource = 'webi';
$this->ready_headers[$resource] = '';
if (isset($this->SubBody[$resource]['body']))
$resource_body = $resource;
else
$resource_body = 'webi';
if (!is_array($this->sendto[$resource]) OR !count($this->sendto[$resource]))
{
$this->status_mail['status'] = false;
$this->status_mail['message'] = "Error : no recipient selected for ".$resource;
// return false;
}
if (!isset($this->body[$resource_body]))
{
if (count($this->SubBody[$resource_body]['body']) > 1)
{
$body = implode("\r\n--REL-".$this->boundary."\r\n", $this->SubBody[$resource_body]['body']);
$body = "Content-Type: multipart/related; boundary=REL-".$this->boundary."\r\n\r\n"
.'--REL-'.$this->boundary."\r\n".$body.'--REL-'.$this->boundary."--";
}
else
{
$body = $this->SubBody[$resource_body]['body'][0];
}
if (isset($this->SubBody[$resource_body]['mixed']) AND count($this->SubBody[$resource_body]['mixed']))
{
$bodymix = implode('--MIX-'.$this->boundary."\r\n", $this->SubBody[$resource_body]['mixed']);
$body = $body."\r\n--MIX-".$this->boundary."\r\n".$bodymix;
$body = "Content-Type: multipart/mixed; boundary=MIX-".$this->boundary."\r\n\r\n"
.'--MIX-'.$this->boundary."\r\n".$body.'--MIX-'.$this->boundary."--";
}
unset($this->SubBody[$resource_body]);
$temp_mass = explode("\r\n\r\n", $body);
$this->body_header[$resource_body] = $temp_mass[0];
unset($temp_mass[0]);
$this->body[$resource_body] = implode("\r\n\r\n", $temp_mass);
unset($temp_mass);
unset($body);
}
$temp_mass = array();
foreach ($this->sendto[$resource] as $key => $value)
{
if (strlen($this->names_email[$resource]['To'][$value]))
$temp_mass[] = "=?".$this->charset."?Q?".str_replace("+", "_", str_replace("%", "=", urlencode(strtr($this->names_email[$resource]['To'][$value], "\r\n", " "))))."?= <".$value.">";
else
$temp_mass[] = $value;
}
$this->headers[$resource]['To'] = implode(", ", $temp_mass);
if (isset($this->acc[$resource]) and count($this->acc[$resource]) > 0)
$this->headers[$resource]['CC'] = implode(", ", $this->acc[$resource]);
if (isset($this->abcc[$resource]) and count($this->abcc[$resource]) > 0)
$this->headers[$resource]['BCC'] = implode(", ", $this->abcc[$resource]);
if ($this->receipt)
{
if (isset($this->headers["Reply-To"]))
$this->headers["Disposition-Notification-To"] = $this->headers["Reply-To"];
else
$this->headers["Disposition-Notification-To"] = $this->headers['From'];
}
if ($this->charset != "")
{
$this->headers["Mime
没有合适的资源?快使用搜索试试~ 我知道了~
前端设计关于案例展示模板是一款前端设计人员案例展示bootstrap模板下载。_html网站模板_网页源码移动端前端_.rar
共72个文件
jpg:21个
js:18个
css:16个
0 下载量 124 浏览量
2023-08-05
13:37:42
上传
评论
收藏 2.9MB RAR 举报
温馨提示
前端设计关于案例展示模板是一款前端设计人员案例展示bootstrap模板下载。_html网站模板_网页源码移动端前端_.rar
资源推荐
资源详情
资源评论
收起资源包目录
前端设计关于案例展示模板是一款前端设计人员案例展示bootstrap模板下载。_html网站模板_网页源码移动端前端_.rar (72个子文件)
前端设计关于案例展示模板是一款前端设计人员案例展示bootstrap模板下载。
moban610
js
PIE.php 613B
PIE.htc 40KB
TMForm.js 46KB
jquery.knob.js 26KB
excanvas.js 26KB
modal.js 7KB
jquery.mousewheel.js 8KB
isotope.pkgd.js 101KB
jquery.simplr.smoothscroll.js 1KB
html5shiv.js 2KB
isotop_ini.js 1KB
jquery.easing.1.3.js 8KB
jquery.js 91KB
jquery.singlePageNav.min.js 2KB
touchTouch.jquery.js 6KB
jquery-migrate-1.1.1.js 17KB
jquery.mobile.customized.min.js 17KB
jquery.ui.totop.js 2KB
camera.js 68KB
script.js 1KB
bat
recaptchalib.php 10KB
MailHandler.php 3KB
libmail.php 28KB
css
style.css 9KB
superfish.css 4KB
variables.css 0B
camera.css 6KB
owl.carousel.css 921B
stuck.css 925B
countdown.css 1KB
font-awesome.css 25KB
progress.css 3KB
contact-form.css 8KB
animation.css 6KB
form.css 7KB
mixins.css 0B
grid.css 6KB
ie.css 570B
touchTouch.css 2KB
index.html 22KB
images
page-img_3.jpg 9KB
page-img_1.jpg 35KB
slide-3.jpg 246KB
main_texture.png 518KB
big2.jpg 84KB
form-loader.gif 4KB
big1.jpg 159KB
bg-1.jpg 133KB
big5.jpg 174KB
big3.jpg 240KB
gal_img1.jpg 33KB
gal_img4.jpg 47KB
slide-1.jpg 135KB
page-img_4.jpg 10KB
big6.jpg 131KB
gal_img3.jpg 40KB
gal_img2.jpg 34KB
magnifyer.png 1KB
gal_img6.jpg 40KB
camera-loader.gif 3KB
slide-2.jpg 186KB
arrowws.png 2KB
big4.jpg 144KB
gal_img5.jpg 30KB
parallax-1.jpg 354KB
page-img_2.jpg 10KB
preloader.gif 3KB
fonts
FontAwesome.otf 73KB
fontawesome-webfont.eot 71KB
fontawesome-webfont.woff 82KB
fontawesome-webfont.svg 248KB
fontawesome-webfont.ttf 138KB
共 72 条
- 1
资源评论
supeerzdj
- 粉丝: 11
- 资源: 6184
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功