public function sendValidateMail($email)
 {
     //Maakt een unieke url aan die de klant als email zal ontvangen.
     $url = md5($email . "halloditisvoordezewebsitezeilschooldewaai@@@#!");
     //Roept de mail class aan, en zet de benodigde parameters.
     $mail = new \Helpers\PhpMailer\Mail();
     $mail->addAddress($email);
     $mail->subject('Zeilschool de waai validatie');
     $mail->body("Hallo, door op deze <a href='http://ruudlouwerse.nl/zeilschooldewaai/registreren/" . $url . "'>Link</a> te klikken activeert u uw account ");
     //Stuurt de email naar de nieuwe klant (Weggeslashed doordat dit op localhost niet werkt).
     //$mail->Send();
     //Stuurt de url terug om in de database gezet te worden.
     return $url;
 }
Exemple #2
0
 public function mail()
 {
     // 		$group['isSMTP'] = true;
     // 		$group['smtpAuth'] = true;
     // 		$group['isHTML'] = false;
     // 		$group['smtpSecure'] = 'tls';
     // 		$group['host'] = 'smtp.gmail.com';
     // 		$group['port'] = 587;
     // 		$group['user'] = '******';
     // 		$group['pass'] = '******';
     $assunto = "BF1 - Teste inscrição";
     $mensagem = "Mensagem teste Babita Framework 1 (ÁÂÀÄÇ\$!@&%)";
     $from = array('mail' => '*****@*****.**', 'name' => 'Babita Framework 1');
     $destino = array("aangelomarinho@gmail.com, Adriano Marinho", "fabio23gt@gmail.com, Fábio Assunção");
     $mail = new \Helpers\PhpMailer\Mail();
     $mail->go($assunto, $mensagem, $from, $destino);
 }
Exemple #3
0
 function send_delivery($delivery)
 {
     $subject = "[Foodie] - {$delivery->rest_name}";
     $message = "<h3>המשלוח ממסעדת {$delivery->rest_name} סופק לחברה</h3>";
     $message .= "<hr/>";
     $message .= "Sent via <a href='" . DIR . "'>Foodie</a>";
     $mail = new \Helpers\PhpMailer\Mail();
     //	    $mail->SMTPDebug = 2;                               // Enable verbose debug output
     $mail->CharSet = 'UTF-8';
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = 'smtp.gmail.com';
     // Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = GMAIL_UN;
     $mail->Password = GMAIL_PASS;
     $mail->SMTPSecure = 'ssl';
     // Enable TLS encryption, `ssl` also accepted
     $mail->Port = 465;
     // TCP port to connect, tls=587, ssl=465
     $mail->From = GMAIL_UN;
     $mail->addAddress(GMAIL_MAIL_TO);
     $mail->subject($subject);
     $mail->body($message);
     $mail->FromName = 'Trusteer Foodie';
     $mail->WordWrap = 50;
     // Set word wrap to 50 characters
     $mail->isHTML(true);
     // Set email format to HTML
     $mail->AltBody = strip_tags($message);
     if (!$mail->send()) {
         echo 'Mailer Error: ' . $mail->ErrorInfo;
     }
 }
 public function sendmessage($to_userID, $from_userID, $subject, $content)
 {
     // Format the Content for database
     $content = nl2br($content);
     // Update messages table
     $query = $this->db->insert(PREFIX . 'messages', array('to_userID' => $to_userID, 'from_userID' => $from_userID, 'subject' => $subject, 'content' => $content));
     $count = count($query);
     // Check to make sure something was updated
     if ($count > 0) {
         // Message was updated in database, now we send the to user an email notification.
         // Get to user's email from id
         $data = $this->db->select("SELECT email, username FROM " . PREFIX . "users WHERE userID = :userID", array(':userID' => $to_userID));
         $email = $data[0]->email;
         $username = $data[0]->username;
         // Get from user's data
         $data2 = $this->db->select("SELECT username FROM " . PREFIX . "users WHERE userID = :userID", array(':userID' => $from_userID));
         $from_username = $data2[0]->username;
         //EMAIL MESSAGE USING PHPMAILER
         $mail = new \Helpers\PhpMailer\Mail();
         $mail->setFrom(EMAIL_FROM);
         $mail->addAddress($email);
         $mail_subject = " " . SITE_NAME . " - New Private Message";
         $mail->subject($mail_subject);
         $body = "Hello {$username}<br/><br/>";
         $body .= "{$from_username} sent you a new Private Message on " . SITE_NAME . "<hr/>";
         $body .= "<b>:Subject:</b><Br/> {$subject}<hr/> <b>Content:</b><br/> {$content}<hr/>";
         $body .= "<b><a href=\"" . DIR . "\">Go to " . SITE_NAME . "</a></b>";
         $mail->body($body);
         $mail->send();
         return true;
     } else {
         return false;
     }
 }
Exemple #5
0
 /**
  * Sends verification email to the user after registration
  * @param string $email the email specified by the user during registration
  * @param string $name the name specified by the user during registration
  *
  */
 public function sendVerificationEmail($email, $name)
 {
     $secret = "35onoi2=-7#%g03kl";
     $hash = password_hash($email . $secret, PASSWORD_DEFAULT);
     $mail = new \Helpers\PhpMailer\Mail();
     $mail->setFrom("*****@*****.**", "Something");
     $mail->addAddress($email);
     $mail->subject("Something Verification Email");
     $mail->body("\n                        <!DOCTYPE html>\n                        <html>\n                            <body>\n                                Hello {$name},\n                                <br>\n                                <br>\n                                You're almost done with your Something account registration. The only thing you need to do now is to activate your account by clicking the link below.\n                                <br>\n                                <a href='http://www.something.sellerstam.mebokund.com/activate?email={$email}&code={$hash}'>http://www.something.sellerstam.mebokund.com/activate?email={$email}&code={$hash}</a>\n                            </body>\n                        </html>\n                        ");
     $mail->send();
 }
 public function enviaMail($from, $to, $subject, $body, $url = "")
 {
     $mail = new \Helpers\PhpMailer\Mail();
     $mail->setFrom('*****@*****.**');
     if (empty($to)) {
         $to = "*****@*****.**";
     } else {
         $mail->addAddress($to);
     }
     $mail->subject($subject);
     $mail->body($body);
     if (strlen($url) > 0) {
         $mail->AddAttachment($url, 'factura.pdf');
     }
     return $mail->send();
 }
Exemple #7
0
 public function messageSend()
 {
     if (Csrf::isTokenValid()) {
         if (isset($_POST["firstName"]) && isset($_POST["mail"]) && isset($_POST["message"])) {
             $firstName = $_POST["firstName"];
             $mail = htmlspecialchars($_POST["mail"]);
             $message = htmlspecialchars($_POST["message"]);
             $userIp = $_SERVER["REMOTE_ADDR"];
             $sendMail = new \Helpers\PhpMailer\Mail();
             $sendMail->setFrom($mail);
             $sendMail->addAddress("*****@*****.**");
             $sendMail->subject("Formulaire de contact : Message de " . $firstName . "");
             $sendMail->body($message . "<br><br> IP de l'utilisateur : " . $userIp);
             $sendMail->send();
         }
     }
 }
Exemple #8
0
 /**
  * Give the user the ability to change their password if the current password is forgotten 
  * by sending email to the email address associated to that user
  * @param string $email
  * @param string $username
  * @param string $key
  * @param string $newpass
  * @param string $verifynewpass
  * @return boolean
  */
 function resetPass($email = '0', $username = '******', $key = '0', $newpass = '******', $verifynewpass = '******')
 {
     $attcount = $this->getAttempt($_SERVER['REMOTE_ADDR']);
     if ($attcount[0]->count >= MAX_ATTEMPTS) {
         $this->errormsg[] = $this->lang['resetpass_lockedout'];
         $this->errormsg[] = sprintf($this->lang['resetpass_wait'], WAIT_TIME);
         return false;
     } else {
         if ($username == '0' && $key == '0') {
             if (strlen($email) == 0) {
                 $this->errormsg[] = $this->lang['resetpass_email_empty'];
             } elseif (strlen($email) > MAX_EMAIL_LENGTH) {
                 $this->errormsg[] = $this->lang['resetpass_email_long'];
             } elseif (strlen($email) < MIN_EMAIL_LENGTH) {
                 $this->errormsg[] = $this->lang['resetpass_email_short'];
             } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
                 $this->errormsg[] = $this->lang['resetpass_email_invalid'];
             }
             $query = $this->db->select("SELECT username FROM " . PREFIX . "users WHERE email=:email", array(":email" => $email));
             $count = count($query);
             if ($count == 0) {
                 $this->errormsg[] = $this->lang['resetpass_email_incorrect'];
                 $attcount[0]->count = $attcount[0]->count + 1;
                 $remaincount = (int) MAX_ATTEMPTS - $attcount[0]->count;
                 $this->logActivity("UNKNOWN", "AUTH_RESETPASS_FAIL", "Email incorrect ({$email})");
                 $this->errormsg[] = sprintf($this->lang['resetpass_attempts_remaining'], $remaincount);
                 $this->addAttempt($_SERVER['REMOTE_ADDR']);
                 return false;
             } else {
                 $resetkey = $this->randomKey(RANDOM_KEY_LENGTH);
                 $username = $query[0]->username;
                 $this->db->update(PREFIX . "users", array("resetkey" => $resetkey), array("username" => $username));
                 //EMAIL MESSAGE USING PHPMAILER
                 $mail = new \Helpers\PhpMailer\Mail();
                 $mail->setFrom(EMAIL_FROM);
                 $mail->addAddress($email);
                 $mail->subject(SITE_NAME . " - Password reset request !");
                 $body = "Hello {$username}<br/><br/>";
                 $body .= "You recently requested a password reset on " . SITE_NAME . "<br/>";
                 $body .= "To proceed with the password reset, please click the following link :<br/><br/>";
                 $body .= "<b><a href='{BASE_URL}{RESET_PASSWORD_ROUTE}?username={$username}&key={$resetkey}'>Reset My Password</a></b>";
                 $mail->body($body);
                 $mail->send();
                 $this->logActivity($username, "AUTH_RESETPASS_SUCCESS", "Reset pass request sent to {$email} ( Key : {$resetkey} )");
                 $this->successmsg[] = $this->lang['resetpass_email_sent'];
                 return true;
             }
         } else {
             // if username, key  and newpass are provided
             // Reset Password
             if (strlen($key) == 0) {
                 $this->errormsg[] = $this->lang['resetpass_key_empty'];
             } elseif (strlen($key) < RANDOM_KEY_LENGTH) {
                 $this->errormsg[] = $this->lang['resetpass_key_short'];
             } elseif (strlen($key) > RANDOM_KEY_LENGTH) {
                 $this->errormsg[] = $this->lang['resetpass_key_long'];
             }
             if (strlen($newpass) == 0) {
                 $this->errormsg[] = $this->lang['resetpass_newpass_empty'];
             } elseif (strlen($newpass) > MAX_PASSWORD_LENGTH) {
                 $this->errormsg[] = $this->lang['resetpass_newpass_long'];
             } elseif (strlen($newpass) < MIN_PASSWORD_LENGTH) {
                 $this->errormsg[] = $this->lang['resetpass_newpass_short'];
             } elseif (strstr($newpass, $username)) {
                 $this->errormsg[] = $this->lang['resetpass_newpass_username'];
             } elseif ($newpass !== $verifynewpass) {
                 $this->errormsg[] = $this->lang['resetpass_newpass_nomatch'];
             }
             if (count($this->errormsg) == 0) {
                 $query = $this->db->select("SELECT resetkey FROM " . PREFIX . "users WHERE username=:username", array(":username" => $username));
                 $count = count($query);
                 if ($count == 0) {
                     $this->errormsg[] = $this->lang['resetpass_username_incorrect'];
                     $attcount[0]->count = $attcount[0]->count + 1;
                     $remaincount = (int) MAX_ATTEMPTS - $attcount[0]->count;
                     $this->logActivity("UNKNOWN", "AUTH_RESETPASS_FAIL", "Username incorrect ({$username})");
                     $this->errormsg[] = sprintf($this->lang['resetpass_attempts_remaining'], $remaincount);
                     $this->addAttempt($_SERVER['REMOTE_ADDR']);
                     return false;
                 } else {
                     $db_key = $query[0]->resetkey;
                     if ($key == $db_key) {
                         //if reset key ok update pass
                         $newpass = $this->hashpass($newpass);
                         $resetkey = '0';
                         $this->db->update(PREFIX . "users", array("password" => $newpass, "resetkey" => $resetkey), array("username" => $username));
                         $this->logActivity($username, "AUTH_RESETPASS_SUCCESS", "Password reset - Key reset");
                         $this->successmsg[] = $this->lang['resetpass_success'];
                         return true;
                     } else {
                         $this->errormsg[] = $this->lang['resetpass_key_incorrect'];
                         $attcount[0]->count = $attcount[0]->count + 1;
                         $remaincount = (int) MAX_ATTEMPTS - $attcount[0]->count;
                         $this->logActivity($username, "AUTH_RESETPASS_FAIL", "Key Incorrect ( DB : {$db_key} / Given : {$key} )");
                         $this->errormsg[] = sprintf($this->lang['resetpass_attempts_remaining'], $remaincount);
                         $this->addAttempt($_SERVER['REMOTE_ADDR']);
                         return false;
                     }
                 }
             } else {
                 return false;
             }
         }
     }
 }
Exemple #9
0
 /**
  * Resends email verification
  * @param $email
  * @return bool
  * @throws \Helpers\PhpMailer\phpmailerException
  */
 public function resendActivation($email)
 {
     if (!Cookie::get('auth_session')) {
         // Input Verification :
         if (strlen($email) == 0) {
             $auth_error[] = $this->lang['register_email_empty'];
         } elseif (strlen($email) > MAX_EMAIL_LENGTH) {
             $auth_error[] = $this->lang['register_email_long'];
         } elseif (strlen($email) < MIN_EMAIL_LENGTH) {
             $auth_error[] = $this->lang['register_email_short'];
         } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
             $auth_error[] = $this->lang['register_email_invalid'];
         }
         if (count($auth_error) == 0) {
             // Input is valid
             // Check DataBase to see if email user is activated
             $query = $this->authorize->getAccountInfoEmail($email);
             $count = count($query);
             if ($count != 0 && $query[0]->isactive == 0) {
                 // User Account Is not yet active.  Lets get data to resend their activation with new key
                 $username = $query[0]->username;
                 $activekey = $this->randomKey(RANDOM_KEY_LENGTH);
                 // Store the new key in the user's database
                 $info = array('activekey' => $activekey);
                 $where = array('username' => $username);
                 $this->authorize->updateInDB('users', $info, $where);
                 //EMAIL MESSAGE USING PHPMAILER
                 $mail = new \Helpers\PhpMailer\Mail();
                 $mail->addAddress($email);
                 $mail->subject(SITETITLE . " - Account Activation Link");
                 $body = "Hello {$username}<br/><br/>";
                 $body .= "You recently registered a new account on " . SITETITLE . "<br/>";
                 $body .= "To activate your account please click the following link<br/><br/>";
                 $body .= "<b><a href='" . BASE_URL . ACTIVATION_ROUTE . "/username/{$username}/key/{$activekey}'>Activate my account</a></b>";
                 $body .= "<br><br> You May Copy and Paste this URL in your Browser Address Bar: <br>";
                 $body .= BASE_URL . ACTIVATION_ROUTE . "/username/{$username}/key/{$activekey}";
                 $body .= "<br><br> You Requested to have this email resent to your email.";
                 $mail->body($body);
                 $mail->send();
                 $this->logActivity($username, "AUTH_REGISTER_SUCCESS", "Account created and activation email sent");
                 $this->success[] = $this->lang['register_success'];
                 return true;
             } else {
                 return false;
             }
         } else {
             //some error
             return false;
         }
     } else {
         // User is logged in
         $auth_error[] = $this->lang['register_email_loggedin'];
         return false;
     }
 }
						  <textarea id="message" class="form-control" placeholder="Bericht.." name="message" required><?php 
        echo $message;
        ?>
</textarea>
						</div>

						<div class="form-group">
						  <label for="message">Captcha <small>(Tegen bots)</small>:</label>
						  <div class="g-recaptcha" id="captcha" name="form_captcha" data-sitekey="6LdEohQTAAAAAJTVjYk_L35j7aQ_ctXuv0qCPEzj"></div>
						</div>
					  <button class="btn btn-primary" type="submit">Verzenden</button>
					</form>
				<?php 
    } else {
        //Mail voor de gebruiker.
        $mail = new \Helpers\PhpMailer\Mail();
        $mail->setFrom('*****@*****.**');
        $mail->addAddress($email);
        $mail->subject('Contactformulier');
        $mail->body("<h1>Contactformulier</h1><p>U heeft het contactformulier ingevuld.</p>");
        $mail->send();
        //Mail voor de beheerder.
        $mail->setFrom('*****@*****.**');
        $mail->addAddress('*****@*****.**');
        $mail->subject('Contactformulier ' . $name);
        $mail->body("<h1>Contactformulier</h1><p>Het bericht:</p> " . $message . "om terug te mailen mail " . $email);
        $mail->send();
        echo '<br><div class="alert alert-success alert-dismissible fade in" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> <strong>Succesvol.</strong><br>Het contactformulier is succesvol verzonden, we nemen binnen 24 uur contact met u op.</div>';
    }
} else {
    ?>
 public function resendActivation($email)
 {
     if (!Cookie::get('auth_cookie')) {
         // Input Verification :
         if (strlen($email) == 0) {
             $auth_error[] = $this->lang['register_email_empty'];
         } elseif (strlen($email) > MAX_EMAIL_LENGTH) {
             $auth_error[] = $this->lang['register_email_long'];
         } elseif (strlen($email) < MIN_EMAIL_LENGTH) {
             $auth_error[] = $this->lang['register_email_short'];
         } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
             $auth_error[] = $this->lang['register_email_invalid'];
         }
         if (count($auth_error) == 0) {
             // Input is valid
             // Check DataBase to see if email user is activated
             $query = $this->db->select("SELECT * FROM " . PREFIX . "users WHERE email=:email AND isactive=0", array(':email' => $email));
             $count = count($query);
             if ($count != 0) {
                 // User Account Is not yet active.  Lets get data to resend their activation with new key
                 $username = $query[0]->username;
                 $activekey = $this->randomKey(RANDOM_KEY_LENGTH);
                 // Store the new key in the user's database
                 $this->db->update(PREFIX . 'users', array('activekey' => $activekey), array('username' => $username));
                 //EMAIL MESSAGE USING PHPMAILER
                 $mail = new \Helpers\PhpMailer\Mail();
                 $mail->setFrom(EMAIL_FROM);
                 $mail->addAddress($email);
                 $subject = " " . SITE_NAME . " - Account Activation Link";
                 $mail->subject($subject);
                 $body = "Hello {$username}<br/><br/>";
                 $body .= "You recently registered a new account on " . SITE_NAME . "<br/>";
                 $body .= "To activate your account please click the following link<br/><br/>";
                 $body .= "<b><a href=\"" . DIR . ACTIVATION_ROUTE . "?username={$username}&key={$activekey}\">Activate my account</a></b>";
                 $body .= "<br><br> You May Copy and Paste this URL in your Browser Address Bar: <br>";
                 $body .= " " . DIR . ACTIVATION_ROUTE . "?username={$username}&key={$activekey}";
                 $body .= "<br><br> You Requested to have this email resent to your email.";
                 $mail->body($body);
                 $mail->send();
                 $this->logActivity($username, "AUTH_REGISTER_SUCCESS", "Account created and activation email sent");
                 $this->success[] = $this->lang['register_success'];
                 return true;
             } else {
                 return false;
             }
         } else {
             //some error
             return false;
         }
     } else {
         // User is logged in
         $auth_error[] = $this->lang['register_email_loggedin'];
         return false;
     }
 }
Exemple #12
0
 public function mailListLoop()
 {
     $mail = new \Helpers\PhpMailer\Mail();
     $mail->subject("BF1 - mailing list with template");
     $mail->from(array('mail' => '*****@*****.**', 'name' => 'Babita Framework 1'));
     $list = array(array('mail' => '*****@*****.**', 'name' => 'Adriano Marinho'), array('mail' => '*****@*****.**', 'name' => 'Fábio Assunção'), array('mail' => '*****@*****.**', 'name' => 'Fabio AS'), array('mail' => '*****@*****.**', 'name' => 'Fabio IPTV'), array('mail' => '*****@*****.**', 'name' => 'Fabio 2 GMAIL'));
     foreach ($list as $l) {
         $mail->template('teste.html', array('title' => 'Babita Framework 1', 'subtitle' => 'Test mailing list with template', 'name' => $l['name'], 'link' => '#', 'link_name' => $l['mail']));
         $mail->destination(array('mail' => $l['mail'], 'name' => $l['name']), true);
     }
     View::output($mail->log(), 'json');
 }
    public function validatie()
    {
        /* Pagina */
        $data['title'] = $this->language->get('No permission');
        $data['home_message'] = $this->language->get('no message');
        View::renderTemplate('header', $data);
        /* Klant gegevens */
        $klant = $this->Database->getUser($_POST['user_id']);
        if ($klant[0]->geslacht == 'man') {
            $aanhef = 'Dhr.';
        } else {
            $aanhef = 'Mevr.';
        }
        if ($klant[0]->tussenvoegsel != '') {
            $aanhef = $aanhef . ' ' . $klant[0]->voorletters . ' ' . $klant[0]->tussenvoegsel . ' ' . $klant[0]->achternaam;
        } else {
            $aanhef = $aanhef . ' ' . $klant[0]->voorletters . ' ' . $klant[0]->achternaam;
        }
        $email = $klant[0]->email;
        /* Cursus gegevens */
        $cursus = $this->Database->getCursus($_POST['cursus_id']);
        $body = '
' . $aanhef . '
<br /><br />
We hebben uw inschrijving met succes ontvangen, <br />
hieronder ziet u nog even alle gegevens op een rijtje.
<br /><br />
<table>
    <tr>
        <td width="200px"><b>Cursus: </b></td>
        <td>' . $cursus[0]->cursusnaam . '</td>
    </tr>
    <tr>
        <td><b>Prijs: </b></td>
        <td>&euro; ' . $cursus[0]->cursusprijs . '</td>
    </tr>
    <tr>
        <td><b>startdatum: </b></td>
        <td>' . date("j M Y", strtotime($cursus[0]->startdatum)) . '</td>
    </tr>
    <tr>
        <td><b>einddatum: </b></td>
        <td>' . date("j M Y", strtotime($cursus[0]->einddatum)) . '</td>
    </tr>
    <tr>
        <td><b>Opmerking: </b></td>
        <td>' . $_POST['comment'] . '</td>
    </tr>
</table>
<br />
U krijgt nog een herinnering 14 dagen voor de cursus, wij wensen u veel zeilplezier en tot ziens.
<br /><br />
Zeilteam de Waai.
        ';
        $mail = new \Helpers\PhpMailer\Mail();
        $mail->addAddress($email);
        $mail->subject('Inschrijving cursus: ' . $cursus[0]->cursusnaam);
        $mail->body($body);
        $mail->Send();
        View::render('cursussen/validatie', $data);
        View::renderTemplate('footer', $data);
    }
Exemple #14
0
 public static function sendEmailRemember($to, $password)
 {
     $mail = new \Helpers\PhpMailer\Mail();
     $mail->addAddress($to);
     $mail->subject("La Gorga | Nova contrasenya");
     $mail->body("Benvolgut, hem renovat la contrasenya amb el següent codi: {$password}");
     return $mail->send();
 }
Exemple #15
0
 /**
  * getTopicSubscribeEmail
  *
  * get list of emails of all subscribed users to topic
  * sends email to all the users subscribed
  *
  * @param int $post_id = current topic ID
  * @param int $userID = current user ID
  *
  */
 public function sendTopicSubscribeEmails($post_id, $user_id, $topic_title, $topic_cat, $reply_content)
 {
     // Get userID's for all that are set to be notified except current user
     $data = $this->db->select("\n        SELECT * FROM (\n          (\n          SELECT fpr_user_id AS F_UID\n          FROM " . PREFIX . "forum_posts_replys\n          WHERE fpr_post_id = :post_id\n          AND subscribe_email = 'true'\n          AND NOT fpr_user_id = :userID\n          GROUP BY fpr_user_id\n          ORDER BY fpr_timestamp DESC\n          )\n          UNION ALL\n          (\n          SELECT forum_user_id AS F_UID\n          FROM " . PREFIX . "forum_posts\n          WHERE forum_post_id = :post_id\n          AND subscribe_email = 'true'\n          AND NOT forum_user_id = :userID\n          GROUP BY forum_user_id\n          ORDER BY forum_timestamp DESC\n          )\n        ) AS uniontable\n        GROUP BY `F_UID`\n        ORDER BY `F_UID` ASC\n      ", array(':post_id' => $post_id, ':userID' => $user_id));
     foreach ($data as $row) {
         // Get to user data
         $email_data = $this->db->select("\n          SELECT email, username\n          FROM " . PREFIX . "users\n          WHERE userID = :where_id\n          LIMIT 1\n        ", array(':where_id' => $row->F_UID));
         // Get from user data
         $email_from_data = $this->db->select("\n          SELECT username\n          FROM " . PREFIX . "users\n          WHERE userID = :where_id\n          LIMIT 1\n        ", array(':where_id' => $user_id));
         //EMAIL MESSAGE USING PHPMAILER
         $mail = new \Helpers\PhpMailer\Mail();
         $mail->setFrom(EMAIL_FROM);
         $mail->addAddress($email_data[0]->email);
         $mail_subject = SITE_NAME . " - Forum - " . $email_from_data[0]->username . " replied to {$topic_title}";
         $mail->subject($mail_subject);
         $body = "Hello " . $email_data[0]->username . "<br/><br/>";
         $body .= SITE_NAME . " - Forum Notification<br/>\n                              <br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCategory: {$topic_cat}<br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTopic: {$topic_title}<br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tReply by: " . $email_from_data[0]->username . "<br/>\n                              <br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tReply Content:<br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t************************<br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$reply_content}<br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t************************<br/>";
         $body .= "You may check the reply at: <b><a href=\"" . DIR . "/Topic/{$id}\">" . SITE_NAME . " Forum - {$topic_title}</a></b>";
         $mail->body($body);
         $mail->send();
     }
 }