Pergunta

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

Foi útil?

Solução

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.

Outras dicas

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";
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top