Link to home
Start Free TrialLog in
Avatar of rolandmy
rolandmyFlag for Malaysia

asked on

mail question in PHP

Below is the simple mail code. I want to exclude $bizid in the $message from the email to user1@xxx.com, but I need to include $bizid for user2@zzz.com and user3@zzz.com in the BCC section. How can I go about it?

<?php

      require_once('includes/connection.php');

      $name = $_POST['fullname'];
      $bizid = $_POST['bizid'];
      $company = $_POST['company'];
      $email = $_POST['email'];
      $mobile = $_POST['mobile'];
      $enquiry = $_POST['about'];

      mysql_select_db($database_DBConn, $DBConn);
      $query_mysql = "SELECT * FROM company WHERE bizid = '$bizid'";

      $mysql = mysql_query($query_mysql , $DBConn) or die(mysql_error());
      $row_mysql = mysql_fetch_assoc($mysql );
      $totalRows_mysql = mysql_num_rows($mysql );
      
      if($row_mysql['email'] == ''){
      $toto = $email;
      }else{
      $toto =      $row_mysql['email'];
      }
      $subject = 'Enquiry - '.$company;
      $message = 'Hi,'."\r\n\r\n".'Welcome:'."\r\n\r\n".'Your Info:'."\r\n".'Business ID: '.$bizid."\r\n".'Company: '.$company."\r\n".'Email: '.$email."\r\n".'Mobile: '.$mobile."\r\n\r\n".'Your enquiry:'."\r\n".$enquiry;
      $headers = 'From: user1@xxx.com' . "\r\n" .
      $headers .= "Reply-To: user1@xxx.com\r\n";
      $headers .= "Return-Path: user1@xxx.com\r\n";
      $headers .= "CC: \r\n";
      $headers .= "BCC: user2@zzz.com, user3@zzz.com\r\n";
    'Reply-To: user1@xxx.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

      mail($toto, $subject, $message, $headers);

mysql_free_result($mysql);
//And close the connection
mysql_close($DBConn);


?>
ASKER CERTIFIED SOLUTION
Avatar of Peter Kwan
Peter Kwan
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial