문제

If the clients email id is fatched using below code.

$message .= 'Email: '.$_POST['email']. "\n\r";

I guess $email is variable for client's email id. How do I send an email as BC to the client's email id?

Right now I am using only single email id using

$to = 'emailid@domain.com';

Update: The email field value is <?php echo $_SESSION['email']; ?> in the form.

Update: I have pasted entire code at http://pastebin.com/5bWDQSk2

도움이 되었습니까?

해결책

If you're running at least 4.3, you can set a Bcc additional header. PHP will interpret this internally before sending the message.

$headers = "Bcc: address@place.com\r\nFrom: me@place.com"; // etc
mail( $to, $subject, $message, $headers );

See the docs: http://www.php.net/manual/en/function.mail.php

Also note that because PHP doesn't expand escape sequences (\r, \n) when using single quotes, you must use double quotes for this string.

다른 팁

You have to add custom headers:

# bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

mail('recipient@host.com', 'Subject', 'Message', 'Bcc: emailid@domain.com' )

Add the BCC as a header e.g.

$header = "Bcc: john.doe@yahoo.com";
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top