我正在尝试弄清楚如何在密件抄送中添加电子邮件地址。
由于我添加了更多“$headers”来添加盲电子邮件地址,因此整个代码不再起作用。
<?php
// put your email address here
$youremail = '[email protected]';
// if the url field is empty
if(isset($_POST['url']) && $_POST['url'] == ''){
// prepare message
$body = "Nuovo messaggio dal sito web :
Nome: $_POST[name]
Azienda: $_POST[company]
Telefono: $_POST[phone]
Email: $_POST[email]
Messaggio: $_POST[message]";
if( $_POST['email'] && !preg_match( "/[\r\n]/", $_POST['email']) ) {
$headers = "From: $_POST[email]";
} else {
$headers = "From: $youremail";
}
$headers .= "Bcc: [email protected]\r\n";
mail($youremail, 'Richiesta Informazioni dal Sito Web', $body, $headers );
}
?>
您还需要在标题的第一行添加换行符:
if( $_POST['email'] && !preg_match( "/[\r\n]/", $_POST['email']) ) {
$headers = "From: $_POST[email]\r\n";
} else {
$headers = "From: $youremail\r\n";
}
$headers .= "Bcc: [email protected]\r\n";
mail($youremail, 'Richiesta Informazioni dal Sito Web', $body, $headers );
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)