*
 * LICENSE:
 *
 * This file is part of Loquacity.
 *
 * Loquacity is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Loquacity is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Loquacity; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
require_once "LoquacityMailer.class.php";
// Instantiate your new class
$mail = new LoquacityMailer();
// Now, send a test email
$mail->AddAddress("*****@*****.**");
$mail->Subject = "test email.";
$mail->Body = "Dear john";
// Send email, or display an error.
if (!$mail->Send()) {
    $mail->error_handler("Description: ... some description.\n");
}
echo "Email was sent successfully.";
function sendEmail($user, $email, $passwd)
{
    require_once 'LoquacityMailer.class.php';
    global $myPasswdMgr;
    global $loq;
    $mail = new LoquacityMailer();
    // Now, send an email to the user with the new (unhashed) password
    $mail->AddAddress($email, $user);
    $mail->Subject = "Loquacity password recovery.";
    $mail->From = $loq->_adb->GetOne("SELECT value FROM " . T_CONFIG . " WHERE name='email'");
    $mail->Reciever = $user;
    $mail->Body = "Dear " . $mail->Reciever . ",\n\nThank you for using Loquacity.\nYou have requested for your password to be sent to you via email.\nIf you did not, then please reset your secret answer/question immediately.\n\nYour username is : " . $user . "\nYour new password is: " . $passwd . "\n\nClick on the link below and make sure to change the password immediately.\nTODO: link to his blog...\n\nThis is an automatic message. Please do not reply to it. For further enquiries, visit the forum at \nhttp://forum.loquacity.info\n\nRemember, the Loquacity team will NEVER ask you for your password, so do NOT give it away to anyone.\n\nThank you,\nThe Loquacity Team.";
    // Send email, or display an error.
    if (!$mail->Send()) {
        $mail->error_handler("Description: ... some description.\n");
        $template = 'error.html';
    } else {
        $loq->assign('result', 'The email was sent successfully. You should receive your new password shortly.');
        $template = 'status.html';
    }
}