Mail

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
nashyboy
Forum Newbie
Posts: 14
Joined: Thu May 02, 2002 8:46 am

Mail

Post by nashyboy »

The Ninja Space Goat | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Guys this is probably very straight forward however, i can't quite work it out.

Please see the below code....

Code: Select all

<?php
$to = 'nashy@email.co.uk, ';
$subject = 'test';
$message = "Blah Blah\n\n
Name: " . $name . "\n 
Username: " . $username . "\n 
Site: " . $site . " \n
Role: " . $role . " \n\n
Regards\n
Selection Services";
$headers .= "cc: ghgfd@alh.co.uk\r\n";
$headers .= "From: Can@alh.co.uk\r\n";


mail($to, $subject, $message, $headers);

?>
All works except the cc field.

I receive the email stating it has been cc'd to ghgfd@alh.co.uk however its doesnt actually go to them.....

Someone suggested that it may be the case cc was in but ive tried cc, CC and Cc, all which doesnt work.....

If someone could help it would be appreciated.

Thanks,

Paul


The Ninja Space Goat | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You never create $headers before trying to append to it.

Code: Select all

$to = 'nashy@email.co.uk, ';
$subject = 'test';
$message = "Blah Blah\n\n
Name: " . $name . "\n
Username: " . $username . "\n
Site: " . $site . " \n
Role: " . $role . " \n\n
Regards\n
Selection Services";
$headers = "";
$headers .= "Cc: ghgfd@alh.co.uk\r\n";
$headers .= "From: Can@alh.co.uk\r\n";

mail($to, $subject, $message, $headers);
However, I'd probably recommend downloading a proper mailer and reading this:

http://www.swiftmailer.org/wikidocs/v3/multirecipients
Post Reply