Jump to content

PHP mail shows CC field in message body

- - - - -

  • Please log in to reply
No replies to this topic

#1
RHochstenbach

RHochstenbach

    Learning Programmer

  • Members
  • PipPipPip
  • 56 posts
I am trying to create a PHP script that sends an e-mail with some contents. I also want it to put some addresses in the CC-field. I've set the headers to include the CC, which works. But the CC field is also displayed at the top of each e-mail it sends.

Is there a way to prevent this behavior?

My code:

$headers = "From: sender@email.com\r\n";

$headers .= "Cc: ".$cc ."";

$subject = "testing ".$date;	

mail( $to, $subject, $content, $headers );
The $cc variable contains the CC address. The $to contains the to-address and $content has the contents of the message.

Never mind, I solved it. Apparently there was a line break between the From and CC field which causes this problem. Fixed it like this:

$headers = "From: sender@email.com\n";

$headers .= "Cc: ".$cc ."\r\n";






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users