By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

how to bcc with php

P: 3
I cannot see to get this right... i am so new to php its sick. this is sloppy but hey it works. well all but the bcc part. i would like to see if anyone can help. the
Expand|Select|Wrap|Line Numbers
  1. $_POST 
works like its supposed to but the secondary address does not. please help. if you can.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.         $subject = $_POST['name'];
  3.         $name =  $_POST['name'];
  4.         $email = $_POST['email'];
  5.         $phone = $_POST['phone'];
  6.         $event_location = $_POST['event-location'];
  7.         $event_date = $_POST['event-date'];
  8.         $event_time = $_POST['event-time'];
  9.         $message = $_POST['message'];
  10.         $request = $_POST['request'];
  11.         $servicewriter = $_POST['servicewriter'];
  12.  
  13.         $list=array($name,$email,$phone,$event_location,$event_date,$event_time,$date);
  14.         $strTo = 'example@example.com' . "\r\n";        
  15.         $strTo = trim($_POST["servicewriter"]);
  16.         $strSubject = "Work Order:  " . trim($_POST["name"]);
  17.         $strFrom = "Work Order:  " . trim($_POST["name"]);
  18.         $str_content = "Work Order:". trim($_POST["name"]) . "\r\n" . "Job#: " . trim($_POST["EMAIL"]) . "\r\n" . "Part Description: " . trim
  19.  
  20. ($_POST["phone"]) . "\r\n" . 
  21.         "Part Dimensions: " . trim($_POST["event-location"]) . "\r\n" . "MFG: " . trim($_POST["event-date"]) . "\r\n" .  "Quantity: " . trim
  22.  
  23. ($_POST["event-time"]) . "\r\n" .
  24.         "Comments: " . trim($_POST["message"]) . "\r\n" . "Request Type: " .      trim($_POST["request"]) . "\r\n" ;
  25.                 mail($strTo,$strFrom,$strSubject,$str_content); 
  26.  
  27.             echo ("<SCRIPT LANGUAGE='JavaScript'></SCRIPT>");
  28.              echo "<script>alert(' YOUR EMAIL HAS BEEN SENT. ')</script>";
  29.               echo '<script>reset();</script>';
  30.                echo "<script>window.history.go(-1)</script>";        
  31.  
  32.   ?>
  33.  
  34.  
thank you.
Apr 24 '12 #1

✓ answered by johny10151981

just add a new variable name $additional_headers and in the mail function put it as 4th variable

Share this Question
Share on Google+
3 Replies


100+
P: 1,059
did you read this link?
this is the mail function
Expand|Select|Wrap|Line Numbers
  1. bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
  2.  
you should use $additional_headers to send cc, bcc
Apr 25 '12 #2

P: 3
@johny10151981
do i just keep it inline with the rest of the code or should i rewrite the entire code?
Apr 25 '12 #3

100+
P: 1,059
just add a new variable name $additional_headers and in the mail function put it as 4th variable
Apr 25 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.