/var/www/hkosl.com/innoutstorage/webadmin/test_template.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
    
exit;
    require_once(
'basic_info.php');

    switch (
$_GET['type']) {
        case 
1//contact us
            //send email
            
$email_subject "Online Enquiry";

            
$_POST["template-contactform-name"]    = 'Test';
            
$_POST["template-contactform-phone"]   = '21231231';
            
$_POST["template-contactform-email"]   = 'test@test.com';
            
$_POST["template-contactform-message"] = 'test content';
//email content to customer
            
ob_start();

            
?>
            <html>
            <head>
                <META name=GENERATOR content="MSHTML 8.00.6001.19394">
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

            </head>
            <body style="font-family:arial,helvetica,sans-serif !important;color:#000;background:#fff;">
            <table>
                <tr>
                    <td valign="top">Name:</td>
                    <td valign="top"><?= $_POST["template-contactform-name"?></td>
                </tr>

                <tr>
                    <td valign="top">Phone:</td>
                    <td valign="top"><?= $_POST["template-contactform-phone"?></td>
                </tr>

                <tr>
                    <td valign="top">Email:</td>
                    <td valign="top"><?= $_POST["template-contactform-email"?></td>
                </tr>

                <tr>
                    <td valign="top">Message:</td>
                    <td valign="top"><?= nl2br($_POST["template-contactform-message"]); ?></td>
                </tr>
            </table>

            <br><br><br><br>

            <?= $site_info{"companyname_" $langcode?><br> <a href='<?= $site_info{"url"?>' target='_blank'><?= $site_info{"url"?></a>
            </body>
            </html>

            <?php
            $email_body 
ob_get_contents();

            
ob_end_clean();
            
$enquiryemail $site_info{"enquiryemail"};
            
$company_name $site_info{"companyname_" $langcode};

            
//for customer
            
$x_mail          = new PHPMailer();
            
$x_mail->CharSet "UTF-8";
            
$x_mail->Sender  $enquiryemail;
            
$x_mail->AddReplyTo($enquiryemail$company_name);
            
$x_mail->From     $enquiryemail;
            
$x_mail->FromName $company_name;

            
//send to user not send to client
            //$x_mail->AddAddress($enquiryemail, $company_name);
            
$x_mail->AddAddress('kelvinchan@onesolution.com.hk''Kelvin Chan');

            
$x_mail->WordWrap 50;
            
$x_mail->IsHTML(true);
            
$x_mail->Subject $email_subject;
            
$x_mail->Body    $email_body;

            
var_dump($email_body);

            if (
$x_mail->Send()) {
                echo 
"<script>alert('Your online enquiry has sent. We will reply you as soon as possible.');</script>";
                exit;
            } else {
                echo 
"<script>alert('Your online enquiry cannot send. Please try again.');</script>";
                exit;
            }
            break;


    }