以下代码在我的网站上用于发送电子邮件/查询。我尝试在BCC上添加一个额外的电子邮件地址,但无法弄清楚如何使用它。所以欢迎你的帮助。在此先感谢您的支持!
if($_POST)
{
if(function_exists('pt_check_captch_cond'))
{
if(!pt_check_captch_cond())
{
$url = get_permalink($post->ID);
if(strstr($url,'?'))
{
$url = $url."&emsg=captch";
}else
{
$url = $url."?emsg=captch";
}
wp_redirect($url);
exit;
}
}
$yourname = $_POST['inq_name'];
$youremail = $_POST['inq_email'];
$inq_phone = $_POST['inq_phone'];
$frnd_comments = $_POST['inq_msg'];
$pid = $_POST['pid'];
$post_title = '<a href="'.get_permalink($post->ID).'">'.$post->post_title.'</a>';
$to_name = get_post_meta($post->ID,'email',true);
$to_email = get_post_meta($post->ID,'email',true);
if($to_email=='')
{
$to_email = get_option('admin_email');
}
///////Inquiry EMAIL START//////
global $upload_folder_path;
$clientdestinationfile = TEMPLATEPATH."/library/notification/send_inquiry.txt";
//$message1 = file_get_contents($clientdestinationfile);
$message1 = implode(',',file($clientdestinationfile));
$filecontent_arr1 = explode('[SUBJECT-STR]',$message1);
$filecontent_arr2 = explode('[SUBJECT-END]',$filecontent_arr1[1]);
$subject = $filecontent_arr2[0]. __(' for ').'"'.$post->post_title.'"';
$client_message = $filecontent_arr2[1];
$yourname_link = __('<br>De la : ').$yourname.__('<br>Telefon : ').$inq_phone.'<br><br>Trimis de pe www.BucovinaCazare.ro - <b><a href="'.get_option('siteurl').'">'.get_option('blogname').'</a></b>.';
/////////////customer email//////////////
$search_array = array('[#$to_name#]','[#$post_title#]','[#$frnd_subject#]','[#$frnd_comments#]','[#$your_name#]');
$replace_array = array($to_name,$post_title,$frnd_subject,nl2br($frnd_comments),$yourname_link);
$client_message = str_replace($search_array,$replace_array,$client_message);
/* echo "From : $youremail Name : $yourname <br>";
echo "To : $to_email Name : $to_name <br>";
echo "Subject $subject <br>";
echo "$client_message";
exit;*/
if($to_email)
{
sendEmail($youremail,$yourname,$to_email,$to_name,$subject,$client_message,$extra='');
}
//////Inquiry EMAIL END////////
$url = get_permalink($post->ID);
if(strstr($url,'?'))
{
$url = $url."&send_inquiry=success";
}else
{
$url = $url."?send_inquiry=success";
}
wp_redirect($url);
}