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-
相关文档:
由于某种需要,这一段需要学习PHP,所以在这类记录一下自己的一些心得和自己在学习中遇到的一些问题。(更新中...)
1.Linux和windows下开发PHP
在这两种系统下开发PHP都需要搭建环境,在Linux下一版用apache作为web服务器,而且相对来说环境的搭建很简单;而在windows下要是开发PHP建议用windows server 2003,windows x ......
实例应用:
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 ......
国外的开源技术也影响和推动了国内开源程序的发展,国外优秀开源PHP建站程序一览中,很多国外开源程序并不太符合中国人的使用习惯,而国内有一些厂家或个人也做了一些不错的产品,不少程序是提供源代码下载的,虽然有些在许可协议上和开源许可证有些出入,但其在使用上还是挺符合中国人的使用习惯,今天我就介绍一些国内的PHP&rdqu ......
很久前些的一些文章,那时候技术还在初级阶段,在现在看来代码够烂的,但是人总是一步步走上来的,希望能给初学者一点鼓励了!
<?php
/*********************************************************
filename:multi.php
describe: 显示多于一页的链接
function:分页显示模块
auth ......