PHP模拟SMTP发送邮件的类
PHP模拟SMTP发送邮件的类
<?php
/*********************************************************
filename:mail.class.php
describe:邮箱的配置,经测试可以适用于Linux和windows
function:检查邮箱的合法性,发送基本的邮箱验证信息
author: etongchina@gmail.com
time: 2008-03-06 20:15
checked: 2008-03-11 01:03
*********************************************************/
class SEND_MAIL{
/* Public Variables */
public $smtp_port;
public $from;
public $time_out;
public $host_name;
public $log_file;
public $relay_host;
public $debug;
public $auth;//需要auth身份验证吗?
public $user;
public $pass;
private $sock;
//给类变量赋值 定义构造器
public function __construct($auth = FALSE)
{
$this->debug = FALSE;
$this->relay_host = "smtp.163.com";//服务器名称
$this->smtp_port = 25;//服务器端口 默认为25 yahoo.cn为465
$this->time_out = 30; //is used in fsockopen() 默认:30s #
$this->auth = $auth;
$this->from = "zhoufeng0128@163.com
";
$this->user = "zhoufeng0128";//邮箱用户名
$this->pass = "XXXX"; //邮箱密码
$this->host_name = "localhost"; //is used in HELO command
$this->log_file = "";
$this->sock = FALSE;
}
/* Main Function */
function sendmail($to, $from, $subject = "", $body = "", $mailtype, $cc = "", $bcc = "", $additional_headers = ""){
$mail_from = $this->get_address($this->strip_comment($from));
$body = ereg_replace("(^|(\r\n))(\.)", "\1.\3", $body);
$header .= "MIME-Version:1.0\r\n";
if($mailtype=="HTML"){
$header .= "Content-
相关文档:
方法一:建一个拼音表 t_cosler ,存放每个字母开头的第一个汉字的编号和最后一个汉字的编号。
BatchFile code+------+--------+-------+
| f_PY | cBegin | cEnd |
+------+--------+-------+
| A | 45217 | 45252 |
| B | 45253 | 45760 |
.....
| Z | 54481 | 55289 |
+------+--------+-------+
......
在IIS 5.1 或IIS6 中配置PHP 的FastCGI模式
一、FastCGI是什么?
FastCGI是语言无关的、可伸缩架构的CGI开放扩展,其主要行为是将CGI解释器进程保持在内存中并因此获得较高的性能。众
所周知,CGI解释器的反复加载是CGI性能低下的主要原因,如果CGI解释器保持在内存中并接受FastCGI进程管理器调度,则可以提供良好 ......
实例应用:
1<?
2require_once('../libs/classes/page.class.php');
3$page=new page(array('total'=>1000,'perpage'=>20));
4echo 'mode:1<br>'.$page->show();
5echo '<hr>mode:2<br>'.$page->show(2);
6echo '<hr>mode:3<br>'.$page->show(3);
7echo '&l ......
计划任务(Schedule Task)是windows平台上和cron类似的一个程序,当然功能上差了很多了。
因为需要每个小时运行一个PHP程序,手动操作不现实了。
首先在cmd下测试,例如: c:\appserv\php5\php.exe "C:\AppServ\www\temp2.php"
有一点要注意就是如果那个PHP引用了其他页面,需要提供绝对路径了,至少我的测试 ......
1.冒泡排序
function m_sort($arr)
{
$l = count($arr);
if($l==0) return false;
for($i=0;$i<$l-1;$i++)
{
for($j=$i+1;$j<$l-1;$j++)
......