PHP help?
#1

Hey guys,

I'm having trouble with sending mail to Hotmail using the mail() function within PHP. (Yes, I've checked all the folders, inbox, spam, junk, deleted)

Here's the code for the contact.php
PHP код:
<form action="mail.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
and the mail.php
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 "xxx@hotmail.com";
$subject "Contact Form";
$mailheader "From: $email \r\n";
mail($recipient$subject$formcontent$mailheader) or die("Error!");
echo 
"Thank You!";
?>
Reply
#2

Web hosting or your own VPS?
I'd first check if mail server is configured correctly.
Reply
#3

If its a vps, try "mail" in the terminal. If its just webhosting, the mail function properly is disabled, to prevent spamming.
Reply
#4

It's home server. I was testing it about before buying anything. What's the easiest way to send it to junk or inbox file?

EDIT: I use xampp for this.
Reply
#5

Try installing hMailServer and see whether it'll work then.
http://www.hmailserver.com/
Reply
#6

Anyone good with PHP, Can I add you on skype?
Reply
#7

Be careful testing emails with the mail() function on web hosting, because the email 'xxx@hotmail.com' will actually receive the email.
Reply
#8

As Ironboy500[TW] point correct you need to config your email server details into xampp files(email server address , port.....)
Reply
#9

I've fixed it but I have another problem, PHP isn't inserting into MySQL database. Can someone add me on skype to have a look at it as it's easier
Reply
#10

At the end of query line add or die(mysql_error()); and it will tell you why does it fail to do so.
Pretty simple no?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)