From: <ex...@us...> - 2013-05-02 03:36:30
|
Revision: 5875 http://sourceforge.net/p/web-erp/reponame/5875 Author: exsonqu Date: 2013-05-02 03:36:27 +0000 (Thu, 02 May 2013) Log Message: ----------- 05/02/2013 Exson: Add SendmailBySmtp function to MiscFunctions.php Modified Paths: -------------- trunk/includes/MiscFunctions.php Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2013-05-02 03:35:20 UTC (rev 5874) +++ trunk/includes/MiscFunctions.php 2013-05-02 03:36:27 UTC (rev 5875) @@ -11,7 +11,12 @@ echo getMsg($Msg, $Type, $Prefix); }//prnMsg +function prnMsg1($Msg,$Type='info', $Prefix=''){ + return getMsg($Msg, $Type, $Prefix); + +}//prnMsg + function reverse_escape($str) { $search=array("\\\\","\\0","\\n","\\r","\Z","\'",'\"'); $replace=array("\\","\0","\n","\r","\x1a","'",'"'); @@ -110,12 +115,11 @@ function ContainsIllegalCharacters ($CheckVariable) { if (mb_strstr($CheckVariable,"'") - OR mb_strstr($CheckVariable,'+') + // OR mb_strstr($CheckVariable,'+') OR mb_strstr($CheckVariable,'?') - OR mb_strstr($CheckVariable,'.') OR mb_strstr($CheckVariable,"\"") OR mb_strstr($CheckVariable,'&') - OR mb_strstr($CheckVariable,"\\") + // OR mb_strstr($CheckVariable,"\\") OR mb_strstr($CheckVariable,'"') OR mb_strstr($CheckVariable,'>') OR mb_strstr($CheckVariable,'<')){ @@ -133,8 +137,14 @@ echo '</pre></div>'; } +function json_result($result,$msg){ + $MES[$result] = $msg; + echo json_encode($MES); + +} + class XmlElement { var $name; var $attributes; @@ -402,4 +412,24 @@ } } -?> \ No newline at end of file +function SendMailBySmtp(&$mail,$To) { + + if(strpos('@',$_SESSION['SMTPSettings']['username'])){//user has set the fully mail address as user name + $mail->setFrom($_SESSION['SMTPSettings']['username']); + }else{//user only set it's name instead of fully mail address + if(strpos('smtp',$_SESSION['SMTPSettings']['host'])){ + $HostDomain = substr($_SESSION['SMTPSettings']['host'],4); + } + if(!strpos('@',$_SESSION['SMTPSettings']['username'])){ + $SendFrom = $_SESSION['SMTPSettings']['username'].$HostDomain; + } + } + $mail->setFrom($SendFrom); + $result = $mail->send($To,'smtp'); + return $result; +} + + + + +?> |