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

How to write easy php send mail from arrayform html5 template

我在 html5 中找到了不错的模板,但我需要帮助 - 如何将电子邮件从服务器发送到我的电子邮件地址?

<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>

设计者没有制作 php 文件,我不知道如何写这个。请帮帮我http://www.arrayform.com/2017/02/17/standard-business-contact-form-template/

您需要一种服务器端语言来生成电子邮件。如果您使用的是 PHP,那么您的代码可能如下所示:

<?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, \n Your Inquiry Information \n My name is $name \n E-mail :- $email \n   Subject :- $subject \n Message :- \n $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
}
?>

现在你需要给 HTML 中的每个元素一个 name,比如:

<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>

如果您有任何疑虑,请告诉我。