How to send an html form to an email [closed]

2019-09-22 04:49发布

I have this form:

<form class="contact-form" method="post" action="mailto:dre4311@gmail.com">
    <p class="input-block">
        <input type="text" name="name" id="name" placeholder="Name *" />
    </p>
    <p class="input-block">
        <input type="email" name="email" id="email" placeholder="Email *" />
    </p>
    <p class="input-block">
        <button class="button turquoise submit" type="submit" id="submit"><i class="icon-paper-plane-2"></i></button>
    </p>
 </form>

I would like to know, when people fill it how can I send the same filled details in the email?

2条回答
相关推荐>>
2楼-- · 2019-09-22 05:17

Try this method

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$website = $_POST['website'];
$type = $_POST['type'];
$message = $_POST['message'];
$formcontent=" From: $name \n Website: $website \n Message: $message";
$recipient = "YOUREMAIL@HERE.COM";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
?>
查看更多
Evening l夕情丶
3楼-- · 2019-09-22 05:21
<?PHP
$email = $_POST["emailaddress"];
$to = "you@youremail.com";
$subject = "New Email Address for Mailing List";
$headers = "From: $email\n";
$message = "A visitor to your site has sent the following email address to be added to your mailing list.\n

Email Address: $email";
$user = "$email";
$usersubject = "Thank You";
$userheaders = "From: you@youremailaddress.com\n";
$usermessage = "Thank you for subscribing to our mailing list.";
mail($to,$subject,$message,$headers);
mail($user,$usersubject,$usermessage,$userheaders);
?>

i wish may it's will help you .

查看更多
登录 后发表回答