Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

Email from PHP Page

The attached code works fine. It is part of my PHP page that allows the user to choose an employee name from teh drop down list (employee1, employee2, etc.) & when they submit the form, the employee they chose from teh drop down box gets an email with pieces of information form the form...My question is, is it possible for me to add something to this code so the email address email2@gamil.org will get CC on the email? I've tried several different ways but can't seem to get it to work. Can someone help me out? Thanks
switch($_REQUEST['employee']) { 
case "Employee1":
$Email = "employee1@gmail.org";
break;
case "Employee2":
$Email = "employee2@gmail.org";
break;
case "Employee3":
$Email = "employee3@gmail.org";
break;
case "Employee4":
$Email = "employee4@gmail.org";
break;
default:
echo "Error, no employee selected!!!";
break;  
}

$Message = "A clerk has entered a 'Date Submitted to Owner'. Please enter/edit this information.\n \n Cust No : ${_REQUEST['pacts']}\n First Name : ${_REQUEST['fname']} \n Last Name : ${_REQUEST['lname']} \n Date Dislosed to Owner : ${_REQUEST['date_disclo_att']} ";	
$Subject  = "A Clerks Has Disclosed a info to the Owner";
$Headers = "From: thesystem@gmail.org \n"; 

if (mail($Email, $Subject, $Message, $Headers)) {
				
echo "<p><center><h2>My Office</h2></center></p>";
echo "<p><h3><center>Eastern District</center></h3></p>";
echo "<center>An email has been sent to the owner."; 
 
} else { 

echo "This system is not working properly. Please contact IT so they can fix it."; 
 
}

Open in new window

0
wantabe2
Asked:
wantabe2
1 Solution
 
Kim WalkerWeb Programmer/TechnicianCommented:
Insert the following at line 22:

$Headers .= "CC: email2@gamil.org \n";

Open in new window

0
 
wantabe2Author Commented:
That's it! Thanks
0
 
Ray PaseurCommented:
CC, Reply-To, BCC, etc. are all parts of the "additional headers" string.  You may find that it is necessary to separate and terminate these with \r\n instead of just \n.
http://us3.php.net/manual/en/function.mail.php
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now