[html]
1.
執行個體:
[html]
1. $content ="ceshi";
2. $technicalemail="www.2cto.com";
3. $headers = "From: =?utf-8?B?".base64_encode('chenglong')."?= <$technicalemail>\r\n";
4.
5. $content = strip_tags($content);
6. $a = @mail($technicalemail,'=?utf-8?B?'.base64_encode('出錯提交').'?=',$content,$headers);
7. if($a)
8. {
9. echo '郵件發送成功!';
10. }
通過mail()函數發送:
1,需要配置php.ini郵件資訊
開啟php.ini設定檔,配置紅色的位置
; For Win32 only.
SMTP = localhost ---如果本機裝了sendmail,這個表示使用本地郵件伺服器,也可以是ip地址,還有伺服器網域名稱
smtp_port = 25 ---連接埠號碼
; For Win32 only.
;sendmail_from = www.2cto.com ---可寫可不寫 把這裡的分號去掉
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = ----郵件伺服器的路徑
2.mail()函數
mail()函數允許從指令碼直接寄送電子郵件
mail()函數返回的是boolean值,成功返回true,失敗返回flase
mail(to,subject,message,headers,paeameters);
to --必需,規定郵件的接收者
subject --必需,規定郵件的主題,該參數不能包含任何換行字元
message --必需,規定要發送的訊息
headers --可選,規定額外的前序,比如from,Cc以及Bcc 可以參考一些資料
parameters --可選,規定sendmail程式的額外參數
3. php.ini 中 將extension=php_imap.dll前面的“;”去掉
作者:Vericlongmore
http://www.bkjia.com/PHPjc/478152.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478152.htmlTechArticle[html] 1.span style=font-size:18px;執行個體:/span [html] 1. $content =ceshi; 2. $technicalemail=www.2cto.com; 3.$headers = From: =?utf-8?B?.base64_encode(chenglong).?= $technicalemai...