Exemple #1
0
    public static function sendNotificationEmail($title, $body)
    {
        // send notification email
        $to = AppConfig::getNotificationEmail();
        $headers = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
        $headers .= 'From: Waltho <*****@*****.**>' . "\r\n";
        ob_start();
        ?>
    <html>
      <head>
        <title><?php 
        echo $title;
        ?>
</title>
        <style>
          body {
            color: #000;
            font-size: 16px;
            font-family: 'Arial', 'Tahoma';
          }
          span {
            display: inline-block;
            width: 120px;
            font-weight: bold;
          }
        </style>
      </head>
      <body>
        <?php 
        echo $body;
        ?>
      </body>
    </html>
    <?php 
        $message = ob_get_clean();
        $mailError = true;
        try {
            if (mail($to, $title, $message, $headers)) {
                $mailError = false;
            }
        } catch (Exception $ex) {
        }
        return $mailError;
    }