duangutang3940 2015-09-01 11:05
浏览 32
已采纳

将文本框中的输入发布到电子邮件?

I'm trying to build a simple sign up form where a person enters their email and submits.

This input is then emailed to the owner of the site, I thought the code below would work however it isnt?

<form id="signup-form" method="post" action="mailto:email@server.co.uk">
    <input type="text" name="email" id="email" placeholder="Email Address">
    <input type="submit" value="Sign Up">
</form>
  • 写回答

1条回答 默认 最新

  • dsqnonh2763 2015-09-01 11:11
    关注

    You have only created the HTML file. HTML file never interacts with server. To send mail either you have to use Javascript of PHP.

    PHP Code to send email:

        <?php
       $to      = 'nobody@example.com';
       $subject = 'the subject';
       $message = 'hello';
       $headers = 'From: webmaster@example.com' . "
    " .
       'Reply-To: webmaster@example.com' . "
    " .
         'X-Mailer: PHP/' . phpversion();
    
       mail($to, $subject, $message, $headers);
        ?>
    

    Documentaion

    Send Email Using Javascript

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

报告相同问题?

悬赏问题

  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃