最近我遇到了--
作爲php的mail()
函數的頭文件。我試圖谷歌它,但沒有發現任何結果,所以我張貼這個問題。在嘗試編輯我的代碼時,我發現這兩個--
後的id應該是唯一的。我的php腳本用附件發送電子郵件。什麼是 - 在電子郵件標題中?
<?php
$file = "http://wpbrisk.com/download/email/email/doc1.pdf"; // Specify the Url of the attachment here
$filename = "doc1.pdf"; // Specify the name of the file here
$to="[email protected]"; // Enter the mail to which you want to sent the attachement
$your_name = "Hudixt"; // Your name
$from_mail = "[email protected]"; // Your email
$subject = "This is a mail with attachment."; // Subject
$message = "<div id='hello'>World</div>"; // message
// Get the content of the file
$content = file_get_contents($file);
$content = base64_encode($content);
$uid = md5(uniqid(time()));
$header = "From: ".$from_name." <".$from_mail.">\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use different content types here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
$header .= "--".$uid."--";
mail($mailto, $subject, "", $header);
?>
您能否告訴我這是什麼--
意味着在標題和爲什麼它應該是唯一的。
請發佈所有相關代碼和您正在討論的上下文。我想這是關於MIME的部分邊界,對吧? – MrTux 2015-02-07 11:52:43
雙短劃線是以某種格式發表評論的,也許就是這樣 – MightyPork 2015-02-07 11:53:22
對我來說看起來像一些邊界 – PeeHaa 2015-02-07 11:53:50