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 PdfiumViewer pdf转图片
  • ¥15 利用Java连接API接口总是出问题
  • ¥15 请教一个关于镜头标定,棋盘格格子大小的问题(畸变测试)
  • ¥15 el-table输入多维数组怎么实现
  • ¥15 安装GroudingDINO RuntimeError: Error compiling objects for extension
  • ¥15 关于推送项目到github的问题
  • ¥15 急!C++指针编写相关的问题
  • ¥15 kerberos身份认证配置问题
  • ¥30 用python写一个多签情况下波场的代理资源和回收资源
  • ¥15 matlab学期例题代码答疑