}
*/
$subject = "Heartweb Subscription";
$mime = new Mail_Mime();
$text = "Hi<BR><BR>";
$text .= "Your subscription to the Heartweb application is due for renewal in 7days.  TIf you would liek to carry on with your subscription then you will need renew through the application.<BR>";
$text .= "====== IMPORTANT INFORMATION =========<BR>";
$text .= "Please Note <BR>";
$text .= "The information contained within this report is of a confidential nature and should not be shared with any other person.";
// text and html versions of email.
$html = '<html><body>' . $text . '</body></html>';
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->setFrom(SMTP_USER);
$mime->setSubject($subject);
$body = $mime->get();
$headers = $mime->headers();
$smtp = Mail::factory('smtp', array('host' => SMTP_HOST, 'port' => SMTP_PORT, 'auth' => true, 'username' => SMTP_USER, 'password' => SMTP_PASSWORD));
foreach ($return as $row) {
    $mailto = $row['username'];
    if (TRIM($mailto) != '') {
        $mailto = $smtp->send($mailto, $header, $body);
    }
    if (PEAR::isError($mail)) {
        echo 'Mail not send';
    } else {
        echo 'Mail has sent successfully';
    }
}
/* end */