Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

email a form to two recipient in php - only sends to one?

Engaged ,
May 01, 2012 May 01, 2012

have the a form that when it is sent get directed to two recipients how it is only getting through to one, what am i doing wrong please??

mysql_select_db($database_hostprop, $hostprop);

  $Result1 = mysql_query($insertSQL, $hostprop) or die(mysql_error());

 

            // Email Admin

          $to = "name@email.com" . ", " ;

          $to = "name2@email.com";

          // Email Tenant

          $subject = "New";

          $message = "

          <html>

                    <head>

                              <title>New </title>

                    </head>

                    <body>

  <tr>

    <td>Other Comments</td>

    <td>".GetSQLValueString($_POST['otherComments'], "text")."</td>

  </tr>

</body>

          </html>

          ";

 

          // Always set content-type when sending HTML email

          $headers = "MIME-Version: 1.0" . "\r\n";

          $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

          $headers .= 'From:www.website.com <email@domain.com>' . "\r\n";

 

          $send = mail($to,$subject,$message,$headers);

thanks in advance

TOPICS
Server side applications
616
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , May 02, 2012 May 02, 2012

ok  works

changed it to

$to = "name@email.com,name2@email.com" ;

thanks

Translate
LEGEND ,
May 01, 2012 May 01, 2012

Look at your variable assignment operation. You are assigning $to to the first address, then reassigning it to the second. You'd need to concatenate, right?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 02, 2012 May 02, 2012
LATEST

ok  works

changed it to

$to = "name@email.com,name2@email.com" ;

thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines