好吧,我的问题是我正在使用我购买的模板中的 PHP 来制作表单,但我不知道如何修改它,以便当用户发送他们的查询时,它不仅仅到达接收邮件,但副本会发送到其他电子邮件。
我离开了我正在使用的 PHP
从已经非常感谢了!
<?php
$to = '[email protected]';
$name = $_POST['name'];
$tel = $_POST['tel'];
$subject = $_POST['subject'];
$email = $_POST['email'];
$message = $_POST['message'];
// Email Submit
// Note: filter_var() requires PHP >= 5.2.0
if ( isset($email) && isset($name) && isset($tel) && isset($subject)
&& isset($message) && filter_var($email, FILTER_VALIDATE_EMAIL) ) {
// detect & prevent header injections
$test = "/(content-type|bcc:|cc:|to:)/i";
foreach ( $_POST as $key => $val ) {
if ( preg_match( $test, $val ) ) {
exit;
}
}
$body = <<<EMAIL
ASUNTO : $subject
HOLA MI NOMBRE ES, $name.
$message
DE : $name
TEL : $tel
MAIL : $email
EMAIL;
$header = 'From: ' . $_POST["name"] . '<' . $_POST["email"] . '>' . "\r\n" .
'Reply-To: ' . $_POST["email"] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
//
// mail( $to , $_POST['subject'], $_POST['message'], $headers );
mail($to, $subject, $body, $header);
// ^
// Replace with your email
}?>
在您拥有的部分
$header
中,您必须按照您的代码将 CC/BCC 添加到其中:Aquí tienes el manual de la función
mail
y su uso(en el Ejemlo #4 verías lo que necesitas)。Igualmente te recomiendo utilizar PHPMailer si vas a trabajar más con correos。添加到标题:密件抄送:email_de_copy。
在这种情况下:
添加这个