dongyikong6207 2017-08-21 02:52
浏览 41
已采纳

如何从arrayform html5模板编写简单的php发送邮件[关闭]

I find nice template in html5 but i need help - how to send email from server to my email address?

<div class="title">
    <h2>HTML5 AND CSS3 USE FLAT CONTACT FORM WITH TRANSPARENT EFFECT</h2>
    </div>
  <div class="container" id="my_view">
    <p>Contact</p>
     <div class="stripe"></div>
      <div class="animated">
        <form action="" method="post">
            <div class="top-two">
                <input type="text" placeholder="Name"/>
                <input type="text" placeholder="Email"/>
            </div>
            <div class="sub-one">
                <input type="text" placeholder="Subject"/>
                <textarea placeholder="Message"></textarea>
            </div>
            <div class="btn-s">
                <input type="submit" value="SEND"/>
            </div>
        </form>

The designer don't make php file and i don't know how to write to this. Please help me http://www.arrayform.com/2017/02/17/standard-business-contact-form-template/

  • 写回答

1条回答 默认 最新

  • douren2395 2017-08-21 03:12
    关注

    You'll need a server-side language to generate an email. If you're using PHP, then your code might look like the following:

    <?php
    ob_start();
    $to = "sagar@sunitainfosys.com"; 
    $name = $_REQUEST['name'];
    $subject = $_REQUEST['subject'];
    $email = $_REQUEST['email'];          
    $message = $_REQUEST['message'];
    
    echo $headers = "From:" . "info@sunitainfosys.com";
    echo $email_body = "Hi, 
     Your Inquiry Information 
     My name is $name 
     E-mail :- $email 
       Subject :- $subject 
     Message :- 
     $message ";
    
    if(mail($to,$subject,$email_body,$headers) or mysql_error()) {
    ?>
    
      <script language="javascript" type="text/javascript"> 
        <!-- alert('Your Message Sent Successfully'); -->
        window.location = 'Youpage.php'; 
      </script> 
    
    <?php
    }
    else {
    ?>
    
      <script language="javascript" type="text/javascript"> 
        <!-- alert('Your Message Not Sent Successfully'); -->
        window.location = 'Youpage.php'; 
      </script> 
    
    <?php
    }
    ?>
    

    And now you need to give a name to each element in the HTML, like:

    <input type="text" placeholder="Name" name="name" />
    <input type="text" placeholder="Email" name="email" />
    <input type="text" placeholder="Subject" name="subject" />
    <textarea placeholder="Message" name="message"></textarea>
    

    Please let me know if you have any concerns.

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

报告相同问题?

悬赏问题

  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)