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 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助