【发布时间】:2015-12-15 22:26:32
【问题描述】:
我想知道在我找到here 和here 的以下PHP sn-p 中md5("sanwebe") 校验和的用途。
“sanwebe”参数有什么作用?
if($file_attached) //continue if we have the file
{
$boundary = md5("sanwebe");
//header
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From:".$from_email."\r\n";
$headers .= "Reply-To: ".$email."" . "\r\n";
$headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n";
//plain text
$body = "--$boundary\r\n";
$body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode($message_body));
//attachment
$body .= "--$boundary\r\n";
$body .="Content-Type: $file_type; name=\"$file_name\"\r\n";
$body .="Content-Disposition: attachment; filename=\"$file_name\"\r\n";
$body .="Content-Transfer-Encoding: base64\r\n";
$body .="X-Attachment-Id: ".rand(1000,99999)."\r\n\r\n";
$body .= $encoded_content;
}else{
//proceed with PHP email.
$headers = "From:".$from_email."\r\n".
'Reply-To: '.$email.'' . "\n" .
'X-Mailer: PHP/' . phpversion();
$body = $message_body;
}
【问题讨论】:
-
边界是强制分隔html版本和纯文本版本的,它是一个分隔符=)
-
多部分电子邮件由“边界”分隔,该字符串不得出现在电子邮件内容中。 w3.org/Protocols/rfc1341/7_2_Multipart.html
标签: php email md5 multipartform-data multipart