Your IP : 216.73.216.79


Current Path : /var/www/html/petpassportv2/common/components/
Upload File :
Current File : /var/www/html/petpassportv2/common/components/EmailModule.php

<?php

namespace common\components;

use Yii;
use yii\base\Component;
use yii\helpers\Url;

class EmailModule {

    public static function sendemail($emailTo = '', $emailSubject = '', $emailContent = '') {
        $output = 'error';
        $emailFrom = 'noreply.testemailweb@gmail.com';
        $email_content2 = '<html>
                <body>
                    <div style="font-family: \'Century Gothic\', CenturyGothic, AppleGothic, sans-serif; font-size: 14px;background-color:rgb(234,234,234);padding:2em 0;">
                        <div style="width:70%;background-color:white;margin:0 auto;padding:5em;border:1px solid #ccc;border-radius:5px;">
                            <center><img src="https://' . $_SERVER['SERVER_NAME']. '/assets/img/logo-ap.png" style="max-width:100%;"></center>
                            <div style="height:1px;background-color:whitesmoke;width:100%;margin:2em 0;"></div>
                            ' . $emailContent . '
                            <div style="height:1px;background-color:whitesmoke;width:100%;margin:2em 0;"></div>
                            <center style="font-size:9px;">
                               <div>Copyright &copy; ' . date('Y') . ' Department of Veterinary Services</div>
                               <div>
                                   <a href="https://petpassport.dvs.gov.my">Animal Passport System</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
                                   <a href="https://epermit2.dvs.gov.my/epermit2/www/admin/index.php?r=site%2Flogin">e-vetpermit</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
                                   <a href="https://www.dvs.gov.my/">Department of Veterinary Services</a>
                                </div>
                                <div>
                                    Any inquiries, please contact: Dr Noor Atikah binti Othman at 03-88702054 (noor.atikah@dvs.gov.my) or En Muhammad Nur Daniel at 03-88702106 (nurdaniel@dvs.gov.my)
                                </div>
                            </center>
                        </div>
                    </div>
                </body>
            </html>';

        if (!empty($emailTo)) {
            $sendemail = Yii::$app->mailer->compose()
                    ->setFrom($emailFrom)
                    ->setTo($emailTo)
                    ->setSubject($emailSubject)
                    ->setHtmlBody($email_content2)
                    ->send();
            if ($sendemail)
                $output = 'success';
        }

        return $output;
    }

}