HTML MAILTO无法正常工作(äöü未正确传输到outlook)

时间:2014-07-09 14:04:41

标签: html outlook mailto utf

当我将字母“üäö”写入我的表格并按提交时,前景中会显示“üÃä”。我的代码出了什么问题。我在脑海中定义了UTF-8。还有什么可以解决这个问题?

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bestellungen</title>
<link rel="stylesheet" type="text/css" href="view.css" media="all">
</head>

<body id="main_body" >  

<form action="MAILTO:mail@mail.ch?subject=DeinBetreff" method="post" enctype="text/plain">  

2 个答案:

答案 0 :(得分:1)

我还没有对此进行过测试,但这对您有用:

<强>更新

经过测试和工作。

Source

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Contact Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form method="post" action="contactengine.php">
<label for="Name">Name:</label>
<input type="text" name="Name" />
<label for="City">City:</label>
<input type="text" name="City" />
<label for="Email">Email:</label>
<input type="text" name="Email" />
<label for="Message">Message:</label>
<textarea name="Message" rows="20" cols="20"></textarea>
<input type="submit" name="submit" value="Submit" class="submit-button" />
</form>
</body>
</html>

PHP:

<?php
$EmailFrom = "example@example.com";
$EmailTo = "example@example.com";
$Subject = "subject";
$Name = Trim(stripslashes($_POST['Name'])); 
$City = Trim(stripslashes($_POST['City'])); 
$Email = Trim(stripslashes($_POST['Email'])); 
$Message = Trim(stripslashes($_POST['Message'])); 
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/plain; charset=utf-8");
?>

答案 1 :(得分:-1)

此问题来自HTML。

确实,HTML存在特殊字符问题。

使用:ü=&amp; yacute,ä=&amp; auml和ö=&amp; ouml。