how to bcc with php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cgleason
    New Member
    • Apr 2012
    • 3

    #1

    how to bcc with php

    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
    Code:
    $_POST
    works like its supposed to but the secondary address does not. please help. if you can.
    Code:
    <?php
            $subject = $_POST['name'];
            $name =  $_POST['name'];
            $email = $_POST['email'];
            $phone = $_POST['phone'];
            $event_location = $_POST['event-location'];
            $event_date = $_POST['event-date'];
            $event_time = $_POST['event-time'];
            $message = $_POST['message'];
            $request = $_POST['request'];
            $servicewriter = $_POST['servicewriter'];
    
            $list=array($name,$email,$phone,$event_location,$event_date,$event_time,$date);
            $strTo = 'example@example.com' . "\r\n";        
            $strTo = trim($_POST["servicewriter"]);
            $strSubject = "Work Order:  " . trim($_POST["name"]);
            $strFrom = "Work Order:  " . trim($_POST["name"]);
            $str_content = "Work Order:". trim($_POST["name"]) . "\r\n" . "Job#: " . trim($_POST["EMAIL"]) . "\r\n" . "Part Description: " . trim
    
    ($_POST["phone"]) . "\r\n" . 
            "Part Dimensions: " . trim($_POST["event-location"]) . "\r\n" . "MFG: " . trim($_POST["event-date"]) . "\r\n" .  "Quantity: " . trim
    
    ($_POST["event-time"]) . "\r\n" .
            "Comments: " . trim($_POST["message"]) . "\r\n" . "Request Type: " .      trim($_POST["request"]) . "\r\n" ;
                    mail($strTo,$strFrom,$strSubject,$str_content); 
    
                echo ("<SCRIPT LANGUAGE='JavaScript'></SCRIPT>");
                 echo "<script>alert(' YOUR EMAIL HAS BEEN SENT. ')</script>";
                  echo '<script>reset();</script>';
                   echo "<script>window.history.go(-1)</script>";        
    
      ?>
    thank you.
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    did you read this link?
    this is the mail function
    Code:
    bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
    you should use $additional_hea ders to send cc, bcc

    Comment

    • cgleason
      New Member
      • Apr 2012
      • 3

      #3
      Originally posted by johny10151981
      did you read this link?
      this is the mail function
      Code:
      bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
      you should use $additional_hea ders to send cc, bcc
      do i just keep it inline with the rest of the code or should i rewrite the entire code?

      Comment

      • johny10151981
        Top Contributor
        • Jan 2010
        • 1059

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

        Comment

        Working...