Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8016741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:37:38+00:00 2026-06-04T20:37:38+00:00

Hi I have a php form that works perfectly when it sends an email

  • 0

Hi I have a php form that works perfectly when it sends an email to one person but when I add another email address it doesn’t send an email to either address. I have been looking on php sites but can’t see why my form is now refusing to email once the second email address is added.

   <?php 
    function isRequestSet( $name ) { 
if ( isset ( $_REQUEST[$name] ) ) { 
    return ( $_REQUEST[$name] != "" ) ;
}
return false;
    }

    $name = "";
     if ( isRequestSet('name' ) ) { 
$name = $_REQUEST['name'];
    } 
    $number = "";
    if ( isRequestSet('number') ) { 
$number = $_REQUEST['number'];
    }
    $email = "";
    if ( isRequestSet( 'email' ) ) { 
$email = $_REQUEST['email'];
    }
     $postcode = "";
     if ( isRequestSet('postcode' ) ) { 
$location = $_REQEUST['postcode'];
     }

     $how_did_you_hear_about_us = array();
     if ( isset( $_REQUEST['how_did_you_hear_about_us'] )  ) { 
$how_did_you_hear_about_us = $_REQUEST['how_did_you_hear_about_us']; 
    }

     $message = "";
      if ( isRequestSet('message' ) ) { 
$location = $_REQEUST['message'];
      }
     $apartment_price_range = array();
      if ( isset( $_REQUEST['apartment_price_range'] )  ) { 
$apartment_price_range = $_REQUEST['apartment_price_range']; 
     }

    $url = "";{
$url = $_REQUEST['url'];
}

    $property = "";{
$property = $_REQUEST['property'];
}


    if ( ($name !="") && ($number != "") && ($email != "") && ($isspam !="yes") ) { 
$to = 'name@email.com,name@email2.com';
$from = $to;
$headers =  'From: ' . $to . "\n" .
            'Reply-To: ' . $to . "\n";
$vars = array( 'name' , 'number' , 'email' , 'postcode' , 'message' ) ;
$message = "-----------\n" ;
foreach ( $vars as $v ) { 
    $value = $_REQUEST[$v];
    $message .= "$v:\t$value\n";
}
$message .= "-----------\n" ;
$message .= "\nHow did you hear about apartments?:\n"  ;
foreach ( $how_did_you_hear_about_us as $how_did_you_hear_about_us ) { 

    $message .= "$how_did_you_hear_about_us\n" ; 
}

$message .= "-----------\n" ;
$message .= "\nApartment price range:\n"  ;
foreach ( $apartment_price_range as $apartment_price_range ) { 

    $message .= "$apartment_price_range\n" ; 
}
$subject = "From: $name <$email>";
mail( $to , $subject , $message , $headers,  "-f $from" );
$confirm = true;
//redirect to the 'thank you' page
header("Location:http://website.com/file/thankyou.php");
     } else { 
$confirm = false;
    }

    ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:37:40+00:00Added an answer on June 4, 2026 at 8:37 pm

    Most likely it is because you use multiple addresses for From and Reply-to fields:

    $to = 'name@email.com,name@email2.com';
    $from = $to;
    

    Change it to use either first email or something like your-service-name@you-domain-name.com

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that works perfectly. Now, when i add the following code,
i have a PHP contact form that submits data, and an email...: <?php $dbh=mysql_connect
I have a form that submits through Ajax, which works perfectly at the moment.
I have a php form that has a known number of columns (ex. top
I currently have a PHP form that uses AJAX to connect to MySQL and
I have an html/php form that updates entries on the database server. I need
I have a form that looks like this. <form action=index.php method=post> <select name=dropdownOption> <option
(Using MySQL and PHP) I have a search form that will allow my users
I have made a form that accepts query and executes it through php. I
I have a js and html form that submits through php. Once submitted, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.