如何自定义联系表单代码以将副本发送到另一封电子邮件


How can I customize contact form code to send a copy to another email?

我在我的wordpress网站上安装了一个主题,我想修改联系人所有者表单的代码。有人可以帮助处理此代码吗?每当有人从本网站/门户向供应商发送电子邮件时,我都想向我的电子邮件发送一份副本。我可以在何处添加代码?

这是文件的链接

<?php
/*
 * AIT WordPress Theme Framework
 *
 * Copyright (c) 2013, Affinity Information Technology, s.r.o. (http://ait-themes.com)
 */
class AitContactOwnerAjax extends AitFrontendAjax
{
	/**
	 * @WpAjax
	 */
	public function send()
	{
		$matches = array();
		preg_match_all('/{([^}]*)}/', $_POST['response-email-content'], $matches);
		foreach($matches[1] as $i => $match){
			$_POST['response-email-content'] = str_replace($matches[0][$i], $_POST[$match], $_POST['response-email-content']);
		}
		$_POST['response-email-content'] = str_ireplace(array("'r'n", "'n"), "<br />", $_POST['response-email-content']);
		$senderName = isset($_POST['response-email-sender-name']) ? $_POST['response-email-sender-name'] : '';
		$headers = array(
			'Content-Type: text/html; charset=UTF-8',
			'Reply-To: '.$_POST['user-name'].' <'.$_POST['user-email'].'>',
			'From: '.$senderName.' <'.$_POST['response-email-sender-address'].'>', 
		);
		//$headers = 'From: '.$_POST['user-name'].' <'.$_POST['user-email'].'>' . "'r'n";
		wp_mail($_POST['response-email-address'], $_POST['response-email-subject'], $_POST['response-email-content'], $headers, null);
		$this->sendJson(array('message' => sprintf(__("Mail sent to %s", 'ait'), $_POST['response-email-address'])));
	}
}

试试这个:

$headers = array(
        'Content-Type: text/html; charset=UTF-8',
        'Reply-To: '.$_POST['user-name'].' <'.$_POST['user-email'].'>',
        'From: '.$senderName.' <'.$_POST['response-email-sender-address'].'>', 
        'CC: '.$yourname.' <'.$youremail.'>', 
    );