Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
62e550d4
ShopXO
项目概览
jcy2004x
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
62e550d4
编写于
1月 11, 2019
作者:
L
lizhenman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
升级phpmailer
上级
2c8fe037
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
4 addition
and
3577 deletion
+4
-3577
extend/base/Email.php
extend/base/Email.php
+4
-3
extend/phpmailer/class.phpmailer.php
extend/phpmailer/class.phpmailer.php
+0
-2326
extend/phpmailer/class.pop3.php
extend/phpmailer/class.pop3.php
+0
-407
extend/phpmailer/class.smtp.php
extend/phpmailer/class.smtp.php
+0
-814
extend/phpmailer/test.php
extend/phpmailer/test.php
+0
-27
未找到文件。
extend/base/Email.php
浏览文件 @
62e550d4
...
...
@@ -9,6 +9,7 @@
// | Author: Devil
// +----------------------------------------------------------------------
namespace
base
;
use
phpmailer\PHPMailer
;
/**
* Email驱动
...
...
@@ -52,10 +53,10 @@ class Email
private
function
EmailInit
()
{
// 引入邮件发送类库
require
ROOT
.
'extend'
.
DS
.
'phpmailer'
.
DS
.
'class.phpmailer.php'
;
//
require ROOT.'extend'.DS.'phpmailer'.DS.'class.phpmailer.php';
// 建立邮件发送类
$this
->
obj
=
new
\
phpm
ailer
();
$this
->
obj
=
new
PHPM
ailer
();
// 使用smtp方式发送
$this
->
obj
->
IsSMTP
();
...
...
@@ -81,7 +82,7 @@ class Email
$this
->
obj
->
FromName
=
MyC
(
'common_email_smtp_send_name'
);
// 是否开启html格式
$this
->
obj
->
IsHTMlang
(
true
);
$this
->
obj
->
isHTML
(
true
);
// 设置编码
$this
->
obj
->
CharSet
=
'utf-8'
;
...
...
extend/phpmailer/class.phpmailer.php
已删除
100755 → 0
浏览文件 @
2c8fe037
此差异已折叠。
点击以展开。
extend/phpmailer/class.pop3.php
已删除
100755 → 0
浏览文件 @
2c8fe037
<?php
/*~ class.pop3.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
| Version: 5.1 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
| Info: http://phpmailer.sourceforge.net |
| Support: http://sourceforge.net/projects/phpmailer/ |
| ------------------------------------------------------------------------- |
| Admin: Andy Prevost (project admininistrator) |
| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
| Founder: Brent R. Matzelle (original founder) |
| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
| Copyright (c) 2001-2003, Brent R. Matzelle |
| ------------------------------------------------------------------------- |
| License: Distributed under the Lesser General Public License (LGPL) |
| http://www.gnu.org/copyleft/lesser.html |
| This program is distributed in the hope that it will be useful - WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. |
| ------------------------------------------------------------------------- |
| We offer a number of paid services (www.codeworxtech.com): |
| - Web Hosting on highly optimized fast and secure servers |
| - Technology Consulting |
| - Oursourcing (highly qualified programmers and graphic designers) |
'---------------------------------------------------------------------------'
*/
/**
* PHPMailer - PHP POP Before SMTP Authentication Class
* NOTE: Designed for use with PHP version 5 and up
* @package PHPMailer
* @author Andy Prevost
* @author Marcus Bointon
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
* @version $Id: class.pop3.php 444 2009-05-05 11:22:26Z coolbru $
*/
/**
* POP Before SMTP Authentication Class
* Version 5.0.0
*
* Author: Richard Davey (rich@corephp.co.uk)
* Modifications: Andy Prevost
* License: LGPL, see PHPMailer License
*
* Specifically for PHPMailer to allow POP before SMTP authentication.
* Does not yet work with APOP - if you have an APOP account, contact Richard Davey
* and we can test changes to this script.
*
* This class is based on the structure of the SMTP class originally authored by Chris Ryan
*
* This class is rfc 1939 compliant and implements all the commands
* required for POP3 connection, authentication and disconnection.
*
* @package PHPMailer
* @author Richard Davey
*/
class
POP3
{
/**
* Default POP3 port
* @var int
*/
public
$POP3_PORT
=
110
;
/**
* Default Timeout
* @var int
*/
public
$POP3_TIMEOUT
=
30
;
/**
* POP3 Carriage Return + Line Feed
* @var string
*/
public
$CRLF
=
"
\r\n
"
;
/**
* Displaying Debug warnings? (0 = now, 1+ = yes)
* @var int
*/
public
$do_debug
=
2
;
/**
* POP3 Mail Server
* @var string
*/
public
$host
;
/**
* POP3 Port
* @var int
*/
public
$port
;
/**
* POP3 Timeout Value
* @var int
*/
public
$tval
;
/**
* POP3 Username
* @var string
*/
public
$username
;
/**
* POP3 Password
* @var string
*/
public
$password
;
/////////////////////////////////////////////////
// PROPERTIES, PRIVATE AND PROTECTED
/////////////////////////////////////////////////
private
$pop_conn
;
private
$connected
;
private
$error
;
// Error log array
/**
* Constructor, sets the initial values
* @access public
* @return POP3
*/
public
function
__construct
()
{
$this
->
pop_conn
=
0
;
$this
->
connected
=
false
;
$this
->
error
=
null
;
}
/**
* Combination of public events - connect, login, disconnect
* @access public
* @param string $host
* @param integer $port
* @param integer $tval
* @param string $username
* @param string $password
*/
public
function
Authorise
(
$host
,
$port
=
false
,
$tval
=
false
,
$username
,
$password
,
$debug_level
=
0
)
{
$this
->
host
=
$host
;
// If no port value is passed, retrieve it
if
(
$port
==
false
)
{
$this
->
port
=
$this
->
POP3_PORT
;
}
else
{
$this
->
port
=
$port
;
}
// If no port value is passed, retrieve it
if
(
$tval
==
false
)
{
$this
->
tval
=
$this
->
POP3_TIMEOUT
;
}
else
{
$this
->
tval
=
$tval
;
}
$this
->
do_debug
=
$debug_level
;
$this
->
username
=
$username
;
$this
->
password
=
$password
;
// Refresh the error log
$this
->
error
=
null
;
// Connect
$result
=
$this
->
Connect
(
$this
->
host
,
$this
->
port
,
$this
->
tval
);
if
(
$result
)
{
$login_result
=
$this
->
Login
(
$this
->
username
,
$this
->
password
);
if
(
$login_result
)
{
$this
->
Disconnect
();
return
true
;
}
}
// We need to disconnect regardless if the login succeeded
$this
->
Disconnect
();
return
false
;
}
/**
* Connect to the POP3 server
* @access public
* @param string $host
* @param integer $port
* @param integer $tval
* @return boolean
*/
public
function
Connect
(
$host
,
$port
=
false
,
$tval
=
30
)
{
// Are we already connected?
if
(
$this
->
connected
)
{
return
true
;
}
/*
On Windows this will raise a PHP Warning error if the hostname doesn't exist.
Rather than supress it with @fsockopen, let's capture it cleanly instead
*/
set_error_handler
(
array
(
&
$this
,
'catchWarning'
));
// Connect to the POP3 server
$this
->
pop_conn
=
fsockopen
(
$host
,
// POP3 Host
$port
,
// Port #
$errno
,
// Error Number
$errstr
,
// Error Message
$tval
);
// Timeout (seconds)
// Restore the error handler
restore_error_handler
();
// Does the Error Log now contain anything?
if
(
$this
->
error
&&
$this
->
do_debug
>=
1
)
{
$this
->
displayErrors
();
}
// Did we connect?
if
(
$this
->
pop_conn
==
false
)
{
// It would appear not...
$this
->
error
=
array
(
'error'
=>
"Failed to connect to server
$host
on port
$port
"
,
'errno'
=>
$errno
,
'errstr'
=>
$errstr
);
if
(
$this
->
do_debug
>=
1
)
{
$this
->
displayErrors
();
}
return
false
;
}
// Increase the stream time-out
// Check for PHP 4.3.0 or later
if
(
version_compare
(
phpversion
(),
'5.0.0'
,
'ge'
))
{
stream_set_timeout
(
$this
->
pop_conn
,
$tval
,
0
);
}
else
{
// Does not work on Windows
if
(
substr
(
PHP_OS
,
0
,
3
)
!==
'WIN'
)
{
socket_set_timeout
(
$this
->
pop_conn
,
$tval
,
0
);
}
}
// Get the POP3 server response
$pop3_response
=
$this
->
getResponse
();
// Check for the +OK
if
(
$this
->
checkResponse
(
$pop3_response
))
{
// The connection is established and the POP3 server is talking
$this
->
connected
=
true
;
return
true
;
}
}
/**
* Login to the POP3 server (does not support APOP yet)
* @access public
* @param string $username
* @param string $password
* @return boolean
*/
public
function
Login
(
$username
=
''
,
$password
=
''
)
{
if
(
$this
->
connected
==
false
)
{
$this
->
error
=
'Not connected to POP3 server'
;
if
(
$this
->
do_debug
>=
1
)
{
$this
->
displayErrors
();
}
}
if
(
empty
(
$username
))
{
$username
=
$this
->
username
;
}
if
(
empty
(
$password
))
{
$password
=
$this
->
password
;
}
$pop_username
=
"USER
$username
"
.
$this
->
CRLF
;
$pop_password
=
"PASS
$password
"
.
$this
->
CRLF
;
// Send the Username
$this
->
sendString
(
$pop_username
);
$pop3_response
=
$this
->
getResponse
();
if
(
$this
->
checkResponse
(
$pop3_response
))
{
// Send the Password
$this
->
sendString
(
$pop_password
);
$pop3_response
=
$this
->
getResponse
();
if
(
$this
->
checkResponse
(
$pop3_response
))
{
return
true
;
}
else
{
return
false
;
}
}
else
{
return
false
;
}
}
/**
* Disconnect from the POP3 server
* @access public
*/
public
function
Disconnect
()
{
$this
->
sendString
(
'QUIT'
);
fclose
(
$this
->
pop_conn
);
}
/////////////////////////////////////////////////
// Private Methods
/////////////////////////////////////////////////
/**
* Get the socket response back.
* $size is the maximum number of bytes to retrieve
* @access private
* @param integer $size
* @return string
*/
private
function
getResponse
(
$size
=
128
)
{
$pop3_response
=
fgets
(
$this
->
pop_conn
,
$size
);
return
$pop3_response
;
}
/**
* Send a string down the open socket connection to the POP3 server
* @access private
* @param string $string
* @return integer
*/
private
function
sendString
(
$string
)
{
$bytes_sent
=
fwrite
(
$this
->
pop_conn
,
$string
,
strlen
(
$string
));
return
$bytes_sent
;
}
/**
* Checks the POP3 server response for +OK or -ERR
* @access private
* @param string $string
* @return boolean
*/
private
function
checkResponse
(
$string
)
{
if
(
substr
(
$string
,
0
,
3
)
!==
'+OK'
)
{
$this
->
error
=
array
(
'error'
=>
"Server reported an error:
$string
"
,
'errno'
=>
0
,
'errstr'
=>
''
);
if
(
$this
->
do_debug
>=
1
)
{
$this
->
displayErrors
();
}
return
false
;
}
else
{
return
true
;
}
}
/**
* If debug is enabled, display the error message array
* @access private
*/
private
function
displayErrors
()
{
echo
'<pre>'
;
foreach
(
$this
->
error
as
$single_error
)
{
print_r
(
$single_error
);
}
echo
'</pre>'
;
}
/**
* Takes over from PHP for the socket warning handler
* @access private
* @param integer $errno
* @param string $errstr
* @param string $errfile
* @param integer $errline
*/
private
function
catchWarning
(
$errno
,
$errstr
,
$errfile
,
$errline
)
{
$this
->
error
[]
=
array
(
'error'
=>
"Connecting to the POP3 server raised a PHP warning: "
,
'errno'
=>
$errno
,
'errstr'
=>
$errstr
);
}
// End of class
}
?>
\ No newline at end of file
extend/phpmailer/class.smtp.php
已删除
100755 → 0
浏览文件 @
2c8fe037
此差异已折叠。
点击以展开。
extend/phpmailer/test.php
已删除
100755 → 0
浏览文件 @
2c8fe037
<?php
require
(
"class.phpmailer.php"
);
$mail
=
new
phpmailer
();
//建立邮件发送类
$mail
->
IsSMTP
();
//使用smtp方式发送
$mail
->
Host
=
'smtp.163.com'
;
$mail
->
SMTPAuth
=
true
;
//smtp验证功能;
$mail
->
Username
=
'weiletao88@163.com'
;
//邮箱用户名
$mail
->
Password
=
'weiletao?'
;
//s邮箱密码
$mail
->
From
=
'weiletao88@163.com'
;
//发件人
$mail
->
FromName
=
"真租网"
;
//发件人姓名
$mail
->
AddAddress
(
"1655098383@qq.com"
,
"用户接收111"
);
//收件人地址,可以替换成任何想要接收邮件的email信箱,格式是AddAddress("收件人email","收件人姓名")
$mail
->
IsHTMlang
(
true
);
//是否开启html格式
$mail
->
CharSet
=
"utf-8"
;
//设置编码
$mail
->
Subject
=
"邮件标题"
;
//邮件标题
$mail
->
Body
=
"<b style='color:#F00;font-size:30px;'>ddddtest</b><img src='http://localhost/zhenzuwang/zzw/Public/Home/Images/logo.png' />"
;
//邮件内容
$mail
->
AltBody
=
"这是一封测试邮件"
;
//邮件正文不支持HTML的备用显示
$mail
->
AddAttachment
(
"../aaa.docx"
);
// 添加附件
if
(
!
$mail
->
Send
()){
echo
"发送失败"
;
echo
"错误原因:"
.
$mail
->
ErrorInfo
;
exit
;
}
else
{
echo
"发送成功!"
;
}
?>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录