首頁 後端開發 php教程 php发送网页邮件的格式(服务器是unix),该怎么解决

php发送网页邮件的格式(服务器是unix),该怎么解决

Jun 13, 2016 am 10:03 AM
gt header nbsp quot this

php发送网页邮件的格式(服务器是unix)
因为服务器事unix的所以用mail函数就可以发邮件,我现在要作的就是像中华英才一样给客户发送简历带有格式那种~~~~

------解决方案--------------------
什么动态呢,你是指那个message那里面的信息是动态的吗,这个很容易啊!
你这里插入一些PHP的表单变量(用户端输入的表单数据),不就可以了吗
------解决方案--------------------
看phpmail类的例子
------解决方案--------------------

设定邮件的头信息中的content-type
Content-Type: text/html; charset="你自己的编码"

从mail的第4个参数设定。
lz参考一下文档,有例子
http://jp.php.net/manual/en/function.mail.php
------解决方案--------------------
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 = "error.txt"; 
$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;charset=utf-8\r\n"; 
//$header .= "Content-Transfer-Encoding: base64\n\n"; 

$header .= "To: ".$to."\r\n"; 

if ($cc != "") 

$header .= "Cc: ".$cc."\r\n"; 


$header .= "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()); 
$TO = explode(",", $this->strip_comment($to)); 

if ($cc != "") 

$TO = array_merge($TO, explode(",", $this->strip_comment($cc))); 


if ($bcc != "") 

$TO = array_merge($TO, explode(",", $this->strip_comment($bcc))); 


$this->Headers = $header; 
$sent = TRUE; 

foreach ($TO as $rcpt_to)

$rcpt_to = $this->get_address($rcpt_to); 
if (!$this->smtp_sockopen($rcpt_to))

$this->log_write("Error: Cannot send email to ".$rcpt_to."\n"); 
$sent = FALSE; 
continue; 


if ($this->smtp_send($this->host_name, $mail_from, $rcpt_to, $header, $body)) 

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前 By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前 By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱門文章標籤

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

解決方法:您的組織要求您更改 PIN 碼 解決方法:您的組織要求您更改 PIN 碼 Oct 04, 2023 pm 05:45 PM

解決方法:您的組織要求您更改 PIN 碼

Windows 11 上調整視窗邊框設定的方法:變更顏色和大小 Windows 11 上調整視窗邊框設定的方法:變更顏色和大小 Sep 22, 2023 am 11:37 AM

Windows 11 上調整視窗邊框設定的方法:變更顏色和大小

如何在 Windows 11 上變更標題列顏色? 如何在 Windows 11 上變更標題列顏色? Sep 14, 2023 pm 03:33 PM

如何在 Windows 11 上變更標題列顏色?

OOBELANGUAGE錯誤Windows 11 / 10修復中出現問題的問題 OOBELANGUAGE錯誤Windows 11 / 10修復中出現問題的問題 Jul 16, 2023 pm 03:29 PM

OOBELANGUAGE錯誤Windows 11 / 10修復中出現問題的問題

Windows 11 上啟用或停用工作列縮圖預覽的方法 Windows 11 上啟用或停用工作列縮圖預覽的方法 Sep 15, 2023 pm 03:57 PM

Windows 11 上啟用或停用工作列縮圖預覽的方法

華為GT3 Pro和GT4的差異是什麼? 華為GT3 Pro和GT4的差異是什麼? Dec 29, 2023 pm 02:27 PM

華為GT3 Pro和GT4的差異是什麼?

Windows 11 上的顯示縮放比例調整指南 Windows 11 上的顯示縮放比例調整指南 Sep 19, 2023 pm 06:45 PM

Windows 11 上的顯示縮放比例調整指南

10種在 Windows 11 上調整亮度的方法 10種在 Windows 11 上調整亮度的方法 Dec 18, 2023 pm 02:21 PM

10種在 Windows 11 上調整亮度的方法

See all articles