my phpemailer help needed

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

When I submit the form on my website it will
not submit to my email nor will I get any errors when I fill out the
form improperly.

Below is the code for the sendformemail.php

Thanks for your help

if(isset($_POST['email'])) {

        $email_to = "";
        $email_subject = "An ACE Pickup has been requested";

        function died($error) {
                // your error code can go here
                echo "We are very sorry, but there were error(s) found
with the form
your submitted. ";
                echo "These errors appear below.<br /><br />";
                echo $error."<br /><br />";
                echo "Please go back and fix these errors.<br /><br /
Quoted text here. Click to load it

        // validation expected data exists
        if(!isset($_POST['first_name']) ||
                !isset($_POST['last_name']) ||
                !isset($_POST['email']) ||
                !isset($_POST['telephone']) ||
                !isset($_POST['address']) ||
                !isset($_POST['city']) ||
                !isset($_POST['comments'])) {
                died('We are sorry, but there appears to be a problem
with the form
your submitted.');

        $first_name = $_POST['first_name']; // required
        $last_name = $_POST['last_name']; // required
        $email_from = $_POST['email']; // required
        $telephone = $_POST['telephone']; // not required
        $comments = $_POST['comments']; // required

        $error_message = "";
        $email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]$";
  if(!eregi($email_exp,$email_from)) {
        $error_message .= 'The Email Address you entered does not
appear to
be valid.<br />';
        $string_exp = "^[a-z .'-]+$";
  if(!eregi($string_exp,$first_name)) {
        $error_message .= 'The First Name you entered does not appear
to be
valid.<br />';
  if(!eregi($string_exp,$last_name)) {
        $error_message .= 'The Last Name you entered does not appear
to be
valid.<br />';
  if(strlen($comments) < 2) {
        $error_message .= 'The Comments you entered do not appear to
valid.<br />';
  $string_exp = "^[0-9 .-]+$";
  if(!eregi($string_exp,$telephone)) {
        $error_message .= 'The Telphone Number you entered does not
to be valid.<br />';
  if(strlen($error_message) > 0) {
        $email_message = "Form details below.\n\n";

        function clean_string($string) {
          $bad = array("content-type","bcc:","to:","cc:","href");
          return str_replace($bad,"",$string);

        $email_message .= "First Name:
        $email_message .= "Last Name: ".clean_string($last_name)."\n";
        $email_message .= "Email: ".clean_string($email_from)."\n";
        $email_message .= "Telephone: ".clean_string($telephone)."\n";
        $email_message .= "Address: ".clean_string($address)."\n";
        $email_message .= "City: ".clean_string($city)."\n";
        $email_message .= "Description:

// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);

<!-- include your own success html here -->



<p> Thank You Your Order has been received. <a href="http://">Click here</a> to return to home</p>

Re: my phpemailer help needed

On 8/24/2010 7:41 AM, Incon wrote:
Quoted text here. Click to load it
<code snipped>

Too much code to go through in detail.  If you want some good help, you
need to cut this down to a minimal case.  But some comments:

First of all, don't use the ereg_xxx functions - they have been
deprecated.  Use the preg_xxx functions instead.

Get rid of the '@' in front of your mail() command - it blocks any error
messages you might be getting.

Your test for a valid email address is woefully inadequate.  It will
reject many valid email addresses, such as the .museum domain.

What OS are you using?  Do you have an MTA running on that system?

Also, ensure you have all error messages enabled and are displaying
them.  In your php.ini file, you should have:

error_reporting=E_ALL  (or E_ALL | E_STRICT)

See what errors you get.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: my phpemailer help needed

In article

Quoted text here. Click to load it

You've suppressed any error on the @mail(... line.  Fix that and show
errors rather than throwning them away.

What do your web server log files show when you look at them?  

If nothing is failing, then the php->web server code is working.  The
problem is on the mail server.  If you're running on a shared web host
you most likely can't fix that or even look at the logs.  Be you can ask
the sysadmin for the logs.  If they won't help, you'll have to find
another web hosting company or change your account to a Linux virtual
host which you manage yourself.  You'll be able to do whatever you want
on that machine as root.

DeeDee, don't press that button!  DeeDee!  NO!  Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]

Site Timeline