dongqin6926 2017-12-25 18:52
浏览 119
已采纳

发送带有希腊字符的电子邮件无法正确显示(使用HTML,Javascript,PHP)

I am trying to make a contact form that opens a new window for confirmation, and from that window, it must open Outlook with the details that I filled in the form. I know that i must use some sort of encoding, but i just can't get it to work. I modified it from my code, with the actual code you start on contact.html, you type your details then you click submit and form.php opens that shows the data, and it has hidden input boxes that also have the data, so they can show in the mail using mailto. Image

My form.php code

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Test</title>
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <form action="mailto:abc123@gmail.com" method="post" enctype="x-www-form-urlencoded">
      <table>
    <tr>
          <td>Name:</td>
          <td><input id="name" type="text" name="name" value="Ύθιρτυθριςδ"></td>
        </tr>
        <tr>
          <td>Surname:</td>
          <td><input id="surname" type="text" name="surname" value="κσξγΙέκεε"></td>
        </tr>
    <tr>
          <td>Tel:</td>
          <td><input id="tel" type="text" name="tel" value="12345"></td>
        </tr>
        <tr>
          <td>E-mail:</td>
          <td><input id="email" type="text" name="email" value="qwerty@gmail.com"></td>
        </tr>
    <tr>
          <td>Request:</td>
          <td><input id="text" type="text" name="Request" value="ΑΒΓΔεζήθίκ"></td>
        </tr>
       </table>
      <br><br>
    <input type="submit" value="Send">
   </form>
  </body>
</html>

</div>
  • 写回答

1条回答 默认 最新

  • douhoulei4706 2017-12-25 21:27
    关注

    Your script to open an email currently works as follows:

    • you click the submit button with the target "mailto:"
    • the mail program opens
    • the email body gets filled with content of the URL (the URL parameters), hence the cryptic looking email body.

    To avoid that, I would suggest to outsource the sending part with a function. E.g. when a user clicks the submit button call the function to send an email and build the actual "link" like so: "mailto:you@yourdomain.com?subject=YOURSUBJECT&body=YOURCONTENT"

    Of course you can use string concatenation to build the string, using the values of your form. That should do the trick.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵