我有以下代码将Web表单发送到Joomla的默认联系电子邮件。我需要将其发送到多个电子邮件地址,例如我们通过cc发送的电子邮件。
session_start(); $func->impromptu(); $data = new Data(); $from = $data->get_value("default_contact_from"); $from_name = 'webmaster'; $subject = 'Website Contact Submission'; $notification_to = $data->get_value("default_contact_email"); if(strpos($notification_to, ",")){ $notification_to = explode(",", $notification_to); } $ignore = array('view', 'option', 'contact_submit'); $required = array('contact_name', 'contact_email', 'contact_phone'); $mainframe =& JFactory::getApplication('site'); $mainframe->initialise(); $captcha_url = $conf->public.'captcha'; if($_POST['contact_submit'] == 'Submit'){ //captcha check if (!$_SESSION['securimage_code_value'] || $_SESSION['securimage_code_value'] != strtolower($_POST['captcha'])) { $error[] = "Invalid captcha code entered"; } foreach($required as $v){ if(!$_POST[$v]){ $error[] = 'Missing required field: '.$v; } } foreach($_POST as $k=>$v){ if(!in_array($k, $ignore)){ $body.= $k." : ".$v."\n"; } } if(!is_array($error)){ //post $send = true; if(is_array($notification_to)){ foreach($notification_to as $v){ $func->email($from, $from_name, trim($v), $subject, $body); } }else { $func->email($from, $from_name, trim($notification_to), $subject, $body); } $func->system_message('Thanks for your submission!'); //$func->reload('Thanks for your submission!'); } else { $func->system_message($error[0]); //$func->reload($error[0]); } } $tpl->assign('captcha_url', $captcha_url); $tpl->set_template('captcha', 'captcha.tpl.php'); $func->css('contact.css'); $func->js('jquery.js');