PHP·¢ËÍEmail Àà
¾²âÊÔ Ã»ÓÐÎÊÌâ
<?
class smtp
{
/* Public Variables */
var $smtp_port;
var $time_out;
var $host_name;
var $log_file;
var $relay_host;
var $debug;
var $auth;
var $user;
var $pass;
/* Private Variables */
var $sock;
/* Constractor */
function smtp($relay_host = "", $smtp_port = 25,$auth = false,$user,$pass)
{
$this->debug = FALSE;
$this->smtp_port = $smtp_port;
$this->relay_host = $relay_host;
$this->time_out = 30; //is used in fsockopen()
#
$this->auth = $auth;//auth
$this->user = $user;
$this->pass = $pass;
#
$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-Type:text/html\r\n";
}
$header .= "To: ".$to."\r\n";
if ($cc != "") {
$header .= "Cc: ".$cc."\r\n";
}
$header .= "from: $from<".$from.">\r\n";
$header .= "Subject: ".$subject."\r\n";
$header .= $additional_headers;
$header .= "Date: ".date("r")."\r\n";
$header .= "X-Mailer:By Redhat (PHP/".phpversion().")\r\n";
list($msec, $sec) = explode(" ", microtime());
$header .= "Message-ID: <".date("YmdHis", $sec).".".($msec*1000000).".".$mail_from.">\r\n";
$TO = explode(",", $this->strip_comment($to));
if ($cc != "") {
$TO = array_merge($TO, explode(",", $this->str
Ïà¹ØÎĵµ£º
Ò»¡¢¿ª·¢³ÉÔ±
a)ÏîÄ¿Ö÷¹Ü
b)Ò³ÃæÃÀ¹¤
c)Ò³Ã濪·¢
d)·þÎñ¶Ë³ÌÐò¿ª·¢
e)ϵͳÓëÊý¾Ý¹ÜÀí
f)²âÊÔÓë°æ±¾¿ØÖÆ
¶þ¡¢ ÍøÕ¾×鿪·¢¼òÃ÷Á÷³Ì
Èý¡¢ ¿ª·¢¹¤¾ßÓë»·¾³
a)·þÎñÆ÷ÅäÖÃ
i. WEB·þÎñÆ÷£º FreeBSD6.1+Apache2.0+PHP5.0£¬SVN°æ±¾¿ØÖÆ·þÎñ(½ö²âÊÔ»ú)¡£
ii.Êý¾Ý¿â·þÎñÆ÷£º WIN2003 server+SQL server  ......
Ò»¡¢¿ª·¢³ÉÔ±
a)ÏîÄ¿Ö÷¹Ü
b)Ò³ÃæÃÀ¹¤
c)Ò³Ã濪·¢
d)·þÎñ¶Ë³ÌÐò¿ª·¢
e)ϵͳÓëÊý¾Ý¹ÜÀí
f)²âÊÔÓë°æ±¾¿ØÖÆ
¶þ¡¢ ÍøÕ¾×鿪·¢¼òÃ÷Á÷³Ì
Èý¡¢ ¿ª·¢¹¤¾ßÓë»·¾³
a)·þÎñÆ÷ÅäÖÃ
i. WEB·þÎñÆ÷£º FreeBSD6.1+Apache2.0+PHP5.0£¬SVN°æ±¾¿ØÖÆ·þÎñ(½ö²âÊÔ»ú)¡£
ii.Êý¾Ý¿â·þÎñÆ÷£º WIN2003 server+SQL server  ......
Ô¤ÆÚ×¼±¸£º
Ò»¸ö139ÓÊÏ䣬ÊÕµ½Óʼþºó£¬¿ÉÒÔÃâ·Ñ¸øÄã¶ÌÐÅÌáÐÑ¡£Èç¹ûÄã²»ÐèÒª¶ÌÐÅÌáÐѹ¦ÄÜ£¬ÓÃʲôÓÊÏ䶼¿ÉÒÔ
ÁíÍâÒ»¸ö¿ÉÒÔÔËÐÐPHPÎļþµÄWeb·þÎñÆ÷£¨Ï൱ÓÚ¼à¿Ø·þÎñÆ÷£©£¬ÏÖÔÚÃâ·ÑµÄPHPÍøÕ¾¿Õ¼äºÜ¶à£¬ÉÏÍøËÑËÑ¡£Èç¹û½«PHP¼à¿ØÎļþ·Åµ½Äã×Ô¼ºµÄ·þÎñ
Æ÷ÉÏ£¬Õâ¸ö¼à¿ØÎļþÒ²¾ÍµÈÓÚ°ÚÉ裬·þÎñÆ÷¹ÒµôÁË£¬ËüÒ²ÎÞ·¨ÔËÐÐÁË£¬ÔõÃ´Ä ......
ÔÚwindows ÏÂÅäÖÃPHPʹÓÃORACLEÊý¾Ý¿âÒªµã
ÔÚwindowÏ£¬¾³£ÓÃapache + PHP À´×öÓ¦ÓÃƽ̨£¬µ«ÊÇÈç¹ûʹÓÃoracle×öºǫ́Êý¾Ý¿â£¬µ«ÓÖûÓа²×°ÓÐoracle¿Í»§¶Ë£¬ÏÂÃæµÄÅäÖÿÉÒԲο¼
1¡¢ÔÚûÓа²×°oracleµÄ»úÆ÷ÉÏ£¬PHPÎÞ·¨¼ÓÔØphp_oci8.dllÄ£¿é£¬ÔÒòÊÇphp_oci8.dllÒÀÀµµÄÏà¹Ø×é¼þûÓÐÕÒµ½¡£
ÄãÕýÈ·ÉèÖÃÁË ......
1.phpÖеÄ__FILE__³£Á¿·µ»ØÎļþµÄÍêÕû·¾¶ºÍÎļþÃû.
2.dirname(__FILE___) º¯Êý·µ»ØµÄÊǽű¾ËùÔÚÔڵķ¾¶¡£
±ÈÈçÎļþ b.php °üº¬ÈçÏÂÄÚÈÝ£º
<?php
$basedir = dirname(__FILE__);
?>
Èç¹ûb.php±»ÆäËûĿ¼ÀïµÄa.phpÎļþrequire »òÕß include È¥ÒýÓõĻ°¡£
±äÁ¿?$basedir µÄÄÚÈÝ»¹ÊÇb.phpËùÔÚµÄÄǸöÎļþ¼Ð ......