Link to home
Start Free TrialLog in
Avatar of wantabe2
wantabe2Flag for United States of America

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of Kim Walker
Kim Walker
Flag of United States of America 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
Avatar of wantabe2

ASKER

That's it! Thanks
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