简体   繁体   中英

how to send and make a php email form

Ok I try to get this every time but I can't I'm using xampp and thunderbird, so I tryed to make a email form so people can contact me but i have the code right but it won't send to my gmail what am I doing wrong. and need to make a activation php too so they can sign up for my website.

<form action="test1.php" method="POST">
<p>Name</p> <input type="text" name="name">
<p>Email</p> <input type="text" name="email">
<p>Phone</p> <input type="text" name="phone">

<p>Request Phone Call:</p>
Yes:<input type="checkbox" value="Yes" name="call"><br />
No:<input type="checkbox" value="No" name="call"><br />

<p>Website</p> <input type="text" name="website">

<p>Priority</p>
<select name="priority" size="1">
<option value="Low">Low</option>
<option value="Normal">Normal</option>
<option value="High">High</option>
<option value="Emergency">Emergency</option>
</select>
<br />

<p>Type</p>
<select name="type" size="1">
<option value="update">Website Update</option>
<option value="change">Information Change</option>
<option value="addition">Information Addition</option>
<option value="new">New Products</option>
</select>
<br />

<p>Message</p><textarea name="message" rows="6" cols="25"></textarea><br />
<input type="submit" value="Send"><input type="reset" value="Clear">
</form>

thats form.html and my php is test1.php

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$call = $_POST['call'];
$website = $_POST['website'];
$priority = $_POST['priority'];
$type = $_POST['type'];
$message = $_POST['message'];
$formcontent=" From: $name \n Phone: $phone \n Call Back: $call \n Website: $website \n            Priority: $priority \n Type: $type \n Message: $message";
$recipient = "dstokesncstudio@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='form.html' style='text-        decoration:none;color:#ff0099;'> Return Home</a>";
?>

Are you hosting on a Linux or other Unix-like systems? If so, depending on where the server(s) where the page is hosted, you need to ensure that sendmail or postfix is actually running.

As root you can run 'mailq' (see man pages) to see if the message is being queued up but there is no daemon running that is processing it.

Also double-check your spam folder to see if it is getting tagged as such by gmail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM