0

Hi all,

Please help me how to add CC and BCC in this code section of form to mail using PHP

<?php

  //send email

  $from = 'enquiry@techxis.com';
  $name = $_REQUEST['txtName'];
  $company = $_REQUEST['txtCompanyName'];
  $jobTitle = $_REQUEST['txtJobTitle'];
  $email = $_REQUEST['txtEmail'] ;
  $contactNo = $_REQUEST['txtContactNo'] ;
$email = $_REQUEST['txtEmail'] ;
  $subject = $_REQUEST['txtSubject'] ; 
  $msg = $_REQUEST['txtMessage'] ;
  $message= " Name : " .$name." \n Company : ".$company." \n Contact Number :".$number." \n Email : ".$email." \n Message : ".$msg;
 $mailsent= mail("parasarashlov@gmail.com", "$subject",
  $message, "From:" . $from);
if($mailsent)
   $msg1="Mail sent succefully";
else
   $msg1="Error occured while sending mail";
 
echo "<script>window.location = 'contactus.html?message={<?php echo $msg1;?>}'</script>"; 
exit;
?>

Please help me as soon as possible.

Thanks and Regards
Nikita Chandra

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by AnkurThakur
0

Read additional_headers in php mail function.

You can do something like this :

$headers = '';
$headers .= 'From: ' . $from . "\r\n";
$headers .= 'Cc: ccemail@example.com' . "\r\n";
$headers .= 'Bcc: bccemail@example.com' . "\r\n";
$mailsent= mail("parasarashlov@gmail.com", "$subject", $message, $headers);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.