I've been digging around this script to send emails, but I really don't know why it is not working. Everything from my point of view looks correct. Well, after couple hours trying I decided it was time to ask an expert to help me to figure why is wrong with it. My page reads php.
and change:
if(!isset($hasError))
into:
if(!$hasError)
glepiza
ASKER
Thanks for your answer angellll,
Still not working, I wonder if it was to do with how Im calling that script from my index.php
this is what I have at the top of the page before the html tag:
<?php
require_once("includes/processing_contact_info.php");
?>
And this is what I have on my form:
<form method="post" action="includes/processing_contact_info.php" id="contactform">
Is that written fine? what do you think?
Thanks
Cornelia Yoder
When you say 'not working', what exactly is not working? Do you simply not get the emails you try to send? Have you checked that they are not going out, or is it possible they are being killed by a spam/junk mail filter? Have you ensured that your server allows emails to be sent from scripts?
2: Use of Deprecated eregi function
--------------------------------------------------- eregi is deprecated in latest PHP stable release. Instead use
preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$/i"
note the syntax carefully preg_match ("/................................/ i ") i for case sensitivity.
3: Missing Header or incomplete headers
---------------------------------------------------
Add these extra and modified headers and try
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: My Site <".$to.">\r\n";
$headers .= "Reply-To: ".$name." <".$email.">\r\n";
4: Get the actual error
-----------------------------------------------------
Add this to get the error message if some goes wrong
$mail_sent = @mail($to, $subject, $body, $headers)
or die;
if ($mail_sent)
$emailSent = true;
------------------------------------------------------
glepiza
ASKER
Hello guys, thanks so much for taking your time answering to my question.
yodercm:
Yes, it is not working because Im not getting the emails Im trying to send. I have checked they are not going out and also checked the span folder etc, but nothing is in there. My serves does allow emails to be sent from scripts. thanks
shaunak:
Thanks so the corrections you sent me. I've not tried yet since I left my computer at home, but I will try it this afternoon and I will let you know if it works.
It seems you were right, sent the script to a friend and it worked perfectly. So I called my hosting provider and they told me I needed to use one of their form scripts since I was under a windows environment. I really did not that it could be an issue of email system server.
Thanks everyone for taking the time to answer my question.
$hasError = false;
and change:
if(!isset($hasError))
into:
if(!$hasError)