我無法獲取我的(圖片)上傳表單正在發送的電子郵件,以支持拉丁字符。不支持拉丁字符的表單郵件
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed\n" .
" boundary=\"{$mime_boundary}\"";
$message ="This is a multi-part message in MIME format.\n\n";
$message.="--{$mime_boundary}\n";
$message.="Content-Type: text/html; charset=utf-8\n";
$message.="Content-Transfer-Encoding: 7bit\n\n";
有什麼想法?
對不起,內容薄了,這會更有幫助嗎?
$fileatt = $_FILES['attachment']['tmp_name'];
$fileatt_type = $_FILES['attachment']['type'];
$fileatt_name = $_FILES['attachment']['name'];
$headers = "From: $emailfrom";
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed\n" .
" boundary=\"{$mime_boundary}\"";
$subject='Presentación de la fotografía';
$message ="This is a multi-part message in MIME format.\n\n";
$message.="--{$mime_boundary}\n";
$message.="Content-Type: text/html; charset=utf-8\n";
$message.="Content-Transfer-Encoding: 7bit\n\n";
$message.="".$namefrom." nos envía este foto.<br />\n\n";
if (is_uploaded_file($fileatt)) {
// Read the file to be attached ('rb' = read binary)
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
// Base64 encode the file data
$data = chunk_split(base64_encode($data));
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
}
$envs = array("HTTP_USER_AGENT", "REMOTE_ADDR", "REMOTE_HOST");
foreach ($envs as $env)
$message .= "$env: $_SERVER[$env]\n";
if(!mail($to,$subject,$message,$headers)) {
exit("Disculpa se ha producido un error. Inténtalo de nuevo. Gracias<");
} else {
echo '<div id="formfeedback">'. $thanksmessage .'</div>';
unset($_SESSION['myForm']);
print_form();
}
奇怪的是,當我在我的Mac上收到我的測試郵件時,我得到的字符無效,但在我的iPhone上顯示正確。
「支持拉丁字符」?你真的想在你的嘗試中不支持拉丁字符嗎? – arkascha
我無法將「我的(圖片)上傳表單發送的電子郵件」與您提供的片段連接起來。如果這段代碼是評估提交上傳表單的php代碼,那麼電子郵件這個詞有什麼用處呢?如果您使用「電子郵件」方法使用表單,那麼這些行會在哪裏起作用? – arkascha
簡而言之:如果您需要任何幫助,您必須提供更多信息。 – arkascha