dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
66
share rss forum feed


nu2this
NOT
Premium
join:2005-04-07
Hallandale, FL
Reviews:
·Comcast

php mail form issue

Hello all!

working on a website and trying to get a form to work and I think the code is messed up as when i go to the site and press the send button, emails are not being sent.

here is the code:

?php
if($_POST){

//your email address
$email_to = "email@domain.com";
//email subject
$emailSubject = "Contact Form";
//edit the emailfrom
$emailFrom = "email@domain.com";

$name = $_POST['name'];
$website = $_POST['website'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];

$text = "NAME: $name

WEBSITE: $website

EMAIL: $email

PHONE: $phone

MESSAGE: $message";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html; charset=utf-8" . "\r\n";
$headers .= "From: " . "\r\n";
mail($email_to, $emailSubject, $text, $headers);
$data['success'] = true;
echo json_encode($data);
}
?>


--
Why are you so surprised to see sinners in church? Are you shocked to see sick people in a hospital too?
»www.USMarketingDirect.com/1000-f···only-32/



Clever_Proxy
Premium
join:2004-05-14
Villa Park, IL

It looks like either you have a lot of syntax error or DSLR's code tags messed with the formatting of your code. You're not getting any php errors when executing this code? If you're running your own webserver, don't forget to check your apache logs.



cowboyro
Premium
join:2000-10-11
Shelton, CT
Reviews:
·AT&T U-Verse
reply to nu2this

Can you sent a test email?

mail('youremail@yourdomain', 'test', 'test email');
 
Looks like you are not sending a "from" field in the headers - is it configured in php.ini?
Can you send a test email by telneting to port 25 on the smtp server?