How do I add a CC to this php email script?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
slipstream
Forum Commoner
Posts: 86
Joined: Fri Apr 19, 2002 8:53 am
Location: Canada

How do I add a CC to this php email script?

Post by slipstream »

Hi all,

I have this bit of script I worked on a long time ago but the boss now wants me to add a cc to the email. It must be put near the From : but I can't remember.

[syntax=php]$headers .= "From: Company <chris@me.net>\r\n";
mail($email, $subject, $msg, $headers);

$msg2 = 'A demo of Freeform DF was requested by '.$email;
mail("chris@forge.net","FF DF Demo Requested", $msg2, $headers);
include("http://www.mettle-animation.com/forge/thankYou.htm");


$file=fopen("demoEmailList.txt", "a+");
fwrite($file, $email."\n");
fclose($file);[/syntax]
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

PHP.net is your friend :D .

They have examples of most functions, here is the one for the mail function:

Code: Select all

<?php
/* additional headers */
$headers .= "To: Mary <mary@example.com>, Kelly <kelly@example.com>\r\n";
$headers .= "From: Birthday Reminder <birthday@example.com>\r\n";
$headers .= "Cc: birthdayarchive@example.com\r\n";
$headers .= "Bcc: birthdaycheck@example.com\r\n";
?>
Post Reply