<?php
//通知會員已收到聯絡我們來函
function notifyusermail($usermail="",$usermane="",$timedate=""){      
           global $xoopsConfig,$xoopsMailer;	      
            $sitename=xlanguagePlugin($xoopsConfig['sitename']);
            $xoopsMailer = & xoops_getMailer();
            $xoopsMailer->addHeaders("MIME-Version: 1.0");
            $xoopsMailer->useMail();
            $xoopsMailer->setToEmails($usermail);
        //    $xoopsMailer->setFromEmail();
            $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);   
            $xoopsMailer->setFromName($sitename);
            $xoopsMailer->setSubject(sprintf(_MA_MAIL08,$usermane,$timedate));   
            //define("_MA_MAIL08","%s您好，我們已經於-%s收到您的聯絡我們來函");
            $xoopsMailer->setBody(sprintf(_MA_MAIL09,$usermane,$timedate,$sitename)); 
            //define("_MA_MAIL09","%s您好\n\r我們已經於%s收到您連寫的聯絡我們來函，我們會盡快回覆您的\n\r%s敬上");
            $xoopsMailer->send();        

}


	
//通知管理員有新的聯絡我們	
function contactusadminmail($cfid="",$usermane="",$getGroupid="",$timedate="",$contactmatters=""){      
            global $xoopsConfig,$xoopsMailer;	    
            $sitename=xlanguagePlugin($xoopsConfig['sitename']);   
            $usermane=xlanguagePlugin($usermane);    
            $contactmatters=xlanguagePlugin($contactmatters);        
            $contactmatters=empty($contactmatters) ? _MA_MAIL07 : $contactmatters; // get TRUE              
            $_url = XOOPS_URL . "/modules/neothemesadmin/contactusform.php?op=usercontent&cfid=".$cfid."";
            $xoopsMailer = & xoops_getMailer();
            $xoopsMailer->addHeaders("MIME-Version: 1.0");
            $xoopsMailer->useMail();
            $member_handler =& xoops_gethandler('member');
            $xoopsMailer->setToGroups($member_handler->getGroup($getGroupid));
            $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            $xoopsMailer->setFromName($sitename);
            $xoopsMailer->setSubject(sprintf(_MA_MAIL03,$timedate,$usermane,$contactmatters));  
       // define("_MA_MAIL03","%s-收到%s聯絡我們來函-諮詢類型：%s");
            $xoopsMailer->setBody(sprintf(_MA_MAIL04,$timedate,$usermane,$contactmatters,$_url,$sitename));  
       //define("_MA_MAIL04","%s-收到%s聯絡我們來函\n\r諮詢類型：%s\n\r請管理員前往觀看回覆\n\r網址：%s\n\r%s");
            $xoopsMailer->send();
}	
	
//回覆聯絡我們
function contactforreplymail($usermail="",$text="",$usermane="",$timedate="",$texe_user=""){      
           global $xoopsConfig,$xoopsMailer;	      
            $sitename=xlanguagePlugin($xoopsConfig['sitename']);
            $text=xlanguagePlugin($text);              
            $xoopsMailer = & xoops_getMailer();
            $xoopsMailer->addHeaders("MIME-Version: 1.0");
            $xoopsMailer->useMail();
            $xoopsMailer->setToEmails($usermail);
        //    $xoopsMailer->setFromEmail();
            $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);   
            $xoopsMailer->setFromName($sitename);
            $xoopsMailer->setSubject(sprintf(_MA_MAIL01,$usermane,$timedate));   
            $xoopsMailer->setBody(sprintf(_MA_MAIL02,$usermane,$text,$texe_user,$sitename)); 
            //define("_MA_MAIL02","%s您好：您的問題回覆如下：\n\r%s\n\r您的問題：%s\n\r%s敬上");
            $xoopsMailer->send();        

}



//通知指定會員
function noticeyusermail($cfid="",$usermail="",$usermane="",$timedate=""){      
            global $xoopsConfig,$xoopsMailer;	   
            $sitename=xlanguagePlugin($xoopsConfig['sitename']);               
            $_url = XOOPS_URL . "/modules/neothemesadmin/contactusform.php?op=usercontent&cfid=".$cfid."";
            $xoopsMailer = & xoops_getMailer();
            $xoopsMailer->addHeaders("MIME-Version: 1.0");
            $xoopsMailer->useMail();
            $xoopsMailer->setToEmails($usermail);
            $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);   
            $xoopsMailer->setFromName($sitename);
            $xoopsMailer->setSubject(sprintf(_MA_MAIL05,$timedate));   
            //define("_MA_MAIL05","%s-網站管理員轉交一則聯絡我們由您回覆");
            $xoopsMailer->setBody(sprintf(_MA_MAIL06,$usermane,$_url,$sitename)); 
            //define("_MA_MAIL06","%s您好\n\r網站管理員轉交一則聯絡我們請您回覆\n\r網址：%s\n\r%s");
            $xoopsMailer->send();        

}

	
	
	
?>