"Warning: Cannot open log file \"".$this->log_file."\"\n"); return FALSE; } flock($fp, LOCK_EX); fputs($fp, $message); fclose($fp);
return TRUE; }
function strip_comment($address) { $comment = "\\([^()]*\\)"; while (ereg($comment, $address)) { $address = ereg_replace($comment, "", $address); }
return $address; }
function get_address($address) { $address = ereg_replace("([ \t\r\n])+", "", $address); $address = ereg_replace("^.*<(.+)>;.*$", "\\1", $address);
return $address; }
function smtp_debug($message) { if ($this->debug) { echo $message; } } } ?>
mail.php
<?php require("sm.php"); ########################################## $smtpserver = "mail.asdf.com";//SMTP服务器 $smtpserverport =25;//SMTP服务器端口 $smtpusermail = "asdf@asdf.com";//SMTP服务器的用户邮箱 $smtpemailto = "asdf@qq.com";//发送给谁 $smtpuser = "asdf@asdf.com";//SMTP服务器的用户帐号 $smtppass = "asdf";//SMTP服务器的用户密码 $mailsubject = "Test Subject";//邮件主题 $mailbody = "<h1>;This is a test mail</h1>;";//邮件内容 $mailtype = "HTML";//邮件格式(HTML/TXT),TXT为文本邮件 ########################################## $smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);//这里面的一个true是表示使用身份验证,否则不使用身份验证. $smtp->debug = TRUE;//是否显示发送的调试信息 $smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype); |