![]() |
| PHP mail - adding a functional Cc: and Bcc |
|
karen_harwood
|
I am tring to get the Cc: in the header to be functional rather than cosmetic. The code below works as far sending an email to the To: address, the Cc: field shows up in the sent email but it does not actually send the mail to the email address I specify in the $headers .= "CC: service@alteredimpressions.com\r\n"; line. I've tried just about everything and still nothing seems to send the Cc: email. Here's the code:
<?php $to = "karen@alteredimpressions.com"; $subject = 'Test Message'; $headers = "From: sales@alteredimpressions.com\r\n"; $headers .= "CC: service@alteredimpressions.com\r\n"; foreach($_POST as $name => $data) { if(is_array($data)) { foreach($data as $datum) $message .= $name . ": " . $datum . "\r\n"; } else $message .= $name . ": " . $data . "\r\n"; } if(mail($to, $subject, $message, $headers)) echo "Mail sent"; else echo "Mail send failure - message not sent"; ?> |
||||||||||||
|
|
|||||||||||||
|
pmeserve
HostMySite Tech
|
Karen,
I tested that code here sending to two of my e-mail addresses and both the To & CC received the message. Are you sure there's not another issue here, e.g. spam/content filtering on the receiving mailbox? |
||||||||||||
|
|
|||||||||||||
|
karen_harwood
|
I tested it again, but this time I entered one of my yahoo mail boxes in my form as apposed to one of my other alteredimpressions.com mail boxes and I was able to get the CC sent to me. So the problem seems to be that I am not able to recieve both the To and the Cc when both emails are being sent to my domain. Not sure what odd settings are causing this but I don't think it matters at this point.
Thanks for your help, without you testing it for me I might have spent another wasted day on this dare thing. |
||||||||||||
|
|
|||||||||||||
| PHP mail - adding a functional Cc: and Bcc |
|
||
|


