/var/www/onesolution.com.hk/support/temp/sendEmailNew.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php 
ini_set
('display_errors'1);
error_reporting(E_ALL);
require(
"class.phpmailer.php");

function 
sendEmail$a_tomail,  $s_title$s_content,$s_sendermail=""){

    
$x_mail = new PHPMailer();
    
//$x_mail->SMTPDebug = true;
    
$x_mail->IsSMTP();    
    
$x_mail->charSet "utf-8";    
    
$x_mail->WordWrap 50;
    
$x_mail->IsHTML(true);

    
//*********** get the setting from db
    
$x_mail->Host ="smtp.pacific.net.hk";//"smtp.gmail.com"; 
    //$x_mail->Port = 465;

    //$x_mail->SMTPAuth = true;
    //$x_mail->Username = "onecms.autogen@gmail.com";
    //$x_mail->Password = "onecms2010";
    //$x_mail->SMTPSecure = "ssl";
    
    
$x_mail->From $s_sendermail;
    if( 
strlen($s_sendermail) == 0){
        
$x_mail->From "autogen@onesolution.com.hk";
    }    

    
$x_mail->FromName "Auto generate";

    
//in case user set no-array object
    
$x_mail->AddAddress($a_tomail);
    
$x_mail->Subject $s_title;
    
$x_mail->Body    $s_content;
    
$x_mail->Send();

    if( 
$x_mail->IsError() > 0){
        echo 
$x_mail->ErrorInfo;
        return 
$x_mail->ErrorInfo;
    }

    return 
true;
}

sendEmail("samliu@onesolution.com.hk""tit""contentttt");
?>