日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

用html做一个发送邮件验证,邮件发送还有问题吗?送大家一个写好的类吧,支持stmp认证、HTML格式邮件-PHP教程,PHP应用...

發(fā)布時間:2025/3/21 php 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 用html做一个发送邮件验证,邮件发送还有问题吗?送大家一个写好的类吧,支持stmp认证、HTML格式邮件-PHP教程,PHP应用... 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

c_smtp_client.php

/* smtp client class */

class c_smtp_client

{

var $connection;

var $server;

var $elog_fp;

var $log_file=./smtp_client.log;

var $do_log=true;

var $need_auth=true;

var $username;

var $password;

// 構造器

function c_smtp_client($server=)

{

if (!$server)

{

$this->server="localhost";

}

else

{

$this->server=$server;

}

$this->connection = fsockopen($this->server, 25);

if ($this->connection <= 0) return 0;

fputs($this->connection,"helo xyz\r\n");

}

function email($from_mail, $to_mail, $to_name, $header, $subject, $body)

{

if ($this->connection <= 0) return 0;

// 郵件用戶認證

if ($this->need_auth)

{

$this->elog("auth login", 1);

fputs($this->connection,"auth login\r\n");

$this->elog(fgets($this->connection, 1024));

$base64_username=base64_encode($this->username);

$this->elog("$base64_username", 1);

fputs($this->connection,"$base64_username\r\n");

$this->elog(fgets($this->connection, 1024));

$base64_password=base64_encode($this->password);

$this->elog("$base64_password", 1);

fputs($this->connection,"$base64_password\r\n");

$this->elog(fgets($this->connection, 1024));

}

$this->elog("mail from:$from_mail", 1);

fputs($this->connection,"mail from:$from_mail\r\n");

$this->elog(fgets($this->connection, 1024));

$this->elog("rcpt to:$to_mail", 1);

fputs($this->connection, "rcpt to:$to_mail\r\n");

$this->elog(fgets($this->connection, 1024));

$this->elog("data", 1);

fputs($this->connection, "data\r\n");

$this->elog(fgets($this->connection, 1024));

$this->elog("subject: $subject", 1);

$this->elog("to: $to_name", 1);

fputs($this->connection,"subject: $subject\r\n");

fputs($this->connection,"to: $to_name\r\n");

if ($header)

{

$this->elog($header, 1);

fputs($this->connection, "$header\r\n");

}

$this->elog("", 1);

$this->elog($body, 1);

$this->elog(".", 1);

fputs($this->connection,"\r\n");

fputs($this->connection,"$body \r\n");

fputs($this->connection,".\r\n");

$this->elog(fgets($this->connection, 1024));

return 1;

}

function send()

{

if ($this->connection)

{

fputs($this->connection, "quit\r\n");

fclose($this->connection);

$this->connection=0;

}

}

function close()

{

$this->send();

}

function elog($text, $mode=0)

{

if (!$this->do_log) return;

// open file

if (!$this->elog_fp)

{

if (!($this->elog_fp=fopen($this->log_file, a))) return;

fwrite($this->elog_fp, "\n——————————————-\n");

fwrite($this->elog_fp, " sent " . date("y-m-d h:i:s") . "\n");

fwrite($this->elog_fp, "——————————————-\n");

}

// write to log

if (!$mode)

{

fwrite($this->elog_fp, "????$text\n");

}

else

{

fwrite($this->elog_fp, "$text\n");

}

}

}

?>

c_mail.php

/* 郵件發(fā)送類 */

require_once dirname(__file__)."/c_smtp_client.php";

static $c_smtp_client;

if(!isset($c_smtp_client))

{

$c_smtp_client??????????????=????& new c_smtp_client($smtp_server[name]);

$c_smtp_client->do_log??????=????false;

$c_smtp_client->need_auth???=????$smtp_server[need_auth];

$c_smtp_client->username????=????$smtp_server[username];

$c_smtp_client->password????=????$smtp_server[password];

}

class c_mail

{

// html格式的mail信箋

function html_mailer($from_name,$from_mail,$to_name,$to_mail,$subject,$message,$reply_mail)

{

$headers?????=????"";

$headers????.=????"mime-version: 1.0\r\n";

$headers????.=????"content-type: text/html; charset=gb2312\r\n";

$headers????.=????"from: ".$from_name."\r\n";

$headers????.=????"to: ".$to_name."\r\n";

$headers????.=????"reply-to: ".$from_name."\r\n";

$headers????.=????"x-priority: 1\r\n";

$headers????.=????"x-msmail-priority: high\r\n";

$headers????.=????"x-mailer: webcms mail serv";

// 開始發(fā)送郵件

if($smtp_server[name]==)

{

@mail($to_mail, $subject, $message, $headers);

}

else

{

$c_smtp_client->email($from_mail,$to_mail,$to_name,$headers,$subject,$message);

$c_smtp_client->send();

}

}

}

?>

config.inc.php

//smtp_server[name]==;則表示直接使用mail();

//smtp_server[name]==localhost;表示程序所在主機的smtp服務器

$smtp_server[name]????????????=????"";

$smtp_server[need_auth]???????=????true;

$smtp_server[username]????????=????;

$smtp_server[password]????????=????;

?>

sendmail.php

//調(diào)用方法

require_once dirname(__file__)."/config.inc.php";

require_once dirname(__file__)."/c_mail.php";

$c_mail????= new c_mail();

$c_mail->html_mailer($from_name,$from_mail,$to_name,$to_mail,$subject,$message,$reply_mail);

?>

《新程序員》:云原生和全面數(shù)字化實踐50位技術專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的用html做一个发送邮件验证,邮件发送还有问题吗?送大家一个写好的类吧,支持stmp认证、HTML格式邮件-PHP教程,PHP应用...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 国产艳妇疯狂做爰视频 | 国产美女裸体无遮挡免费视频 | 樱花影院电视剧免费 | 亚洲伊人成人网 | 宅男噜噜噜 | 日韩中文字幕一区二区三区四区 | 日韩黄色在线 | 精品动漫一区二区三区在线观看 | 亚洲av无码精品一区二区 | 国产精品综合一区二区 | h视频免费在线观看 | 最新av免费在线观看 | 亚洲午夜久久久久 | 密臀av一区二区 | 青青操av在线 | 伊人情人综合 | 色婷婷久久五月综合成人 | 国产男女猛烈无遮挡免费视频 | www.黄色免费| 91国产免费视频 | 日韩电影一区二区 | 欧美热热 | 贝利弗山的秘密1985版免费观看 | 国产午夜大片 | 色哟哟在线视频 | 久久人妻一区二区 | 黄色国产在线视频 | 日本福利在线 | 99成人国产精品视频 | 一本色道久久综合亚洲二区三区 | 精品一区二区三区在线观看视频 | 久久伊人精品视频 | 亚洲大尺度视频 | 日韩精品免费一区 | 男男毛片| 人妻换人妻仑乱 | 国产一二视频 | 国产三级自拍视频 | 日日夜夜国产 | 深夜成人福利 | 扒开腿揉捏花蒂h | 亚洲一区二区国产精品 | 中文字幕一区二区三区四区五区 | 中文字幕精品在线视频 | jizz日韩| 午夜高清| 日韩欧美理论片 | 欧美一区永久视频免费观看 | 捅肌肌 | 亚洲最大的av网站 | 在线a天堂 | 男人的亚洲天堂 | 国产精品免费在线播放 | 精品欧美久久久 | 白俄罗斯毛片 | 91在线亚洲 | 亚洲高清欧美 | 大又大粗又爽又黄少妇毛片 | 国产一区在线观看免费 | 亚洲第99页| 精品午夜一区二区三区在线观看 | 国产乱淫av片杨贵妃 | 久草不卡 | 国产人人爽| 国产亚洲一区二区三区不卡 | 娇喘顶撞深初h1v1 | 精品国产一区二区三区久久久 | 少妇高潮久久久 | 软萌小仙自慰喷白浆 | 无码少妇精品一区二区免费动态 | 搡老熟女老女人一区二区 | 国产久一 | 青青草在线视频免费观看 | 亚洲一区二区三区在线免费观看 | 97在线国产 | 激情综合一区二区三区 | 亚洲深夜福利视频 | 欧美久久一区二区三区 | 综合在线观看 | 国产伦精品一区二区三区千人斩 | 精品人妻一区二区三区久久嗨 | 欧美人与禽猛交乱配视频 | 日韩av综合网 | 国产视频一区二区三区在线观看 | 国产97色 | 曰本三级日本三级日本三级 | 成人婷婷 | 熟妇人妻av无码一区二区三区 | 欧美 另类 交 | 无码精品一区二区三区在线播放 | 九色精品在线 | 激情网络| 欧美 国产 精品 | 卡一卡二卡三 | 粉嫩久久99精品久久久久久夜 | 奇米网久久 | 别揉我奶头一区二区三区 | 欧美性三级 | 精品国产乱码久久久人妻 |