今天要用到php的郵件傳送,便用phpmailer弄了個
類檔案:emaillclass.php
<?php
class phpmailer
function send($addr,$fromname,$title,$content)
$smtp = array(
array("ehlo hello".$lb,"220,250","ehlo error: "),
array("auth login".$lb,"334","auth error:"),
array(base64_encode($this->smtpuser).$lb,"334","authentification error : "),
array(base64_encode($this->smtppass).$lb,"235","authentification error : ")
); $smtp = array("mail from: <".$this->mailfrom.">".$lb,"250","mail from error: ");
$smtp = array("rcpt to: <".$addr.">".$lb,"250","rcpt to error: ");
$smtp = array("data".$lb,"354","data error: ");
$smtp = array("from: ".$fromname.$lb,"","");
$smtp = array("to: ".$addr.$lb,"","");
$smtp = array("subject: ".$title.$lb,"","");
foreach($hdr as $h)
$smtp = array($lb,"","");
if($bdy)
} $smtp = array(".".$lb,"250","data(end)error: ");
$smtp = array("quit".$lb,"221","quit error: ");
$fp = @fsockopen($this->smtphost, 25);
if (!$fp) $this->errmsg = "錯誤:無法連線到 ".$this->smtphost."";
while($result = @fgets($fp, 1024))
}foreach($smtp as $req)
}; if (!strstr($req[1],substr($result,0,3)))
} }
@fclose($fp);
if($this->errmsg =='')else}}
呼叫:send.php
<?php
require_once('emaillclass.php');
$test =new phpmailer("smtp伺服器位址","發件箱位址","發件箱密碼");
$send =$test->send('收件箱位址','發件箱位址','標題','郵件內容');
?>
php 郵件傳送
2 修改class.phpmailer.php 增加變數 fromemail 修改下面內容 成如下內容 if this fromname else result this headerline from this fromemail.fromname result this headerline r...
php 傳送郵件
results wpdb query sql 傳送郵件提醒有人申請 smtpserver smtp.qq.com smtp伺服器,如 smtp.qq.com smtpserverport 25 smtp伺服器端口,一般為25 smtpusermail 117 x837 qq.com smtp伺服器的...
php傳送郵件
php require smtp.php 使用163郵箱伺服器 smtpserver smtp.163.com 163郵箱伺服器端口 smtpserverport 25 你的163伺服器郵箱賬號 smtpusermail 111111 163.com 收件人郵箱 smtpemailto 00000 ...