function send_plain_mail($recipients, $sender, $subject, $body, $headers = array())
{
    $mail = new mime_mail();
    $mail->set_text($body);
    $mail->set_subject($subject);
    $mail->set_from($sender);
    foreach ($headers as $key => $value) {
        $mail->set_header($key, $value);
    }
    return $mail->send($recipients);
}
function send_html_mail($recipients, $sender, $subject, $html, $text = null, $headers = array())
{
    $mail = new mime_mail();
    $mail->set_html($html, $text);
    $mail->set_subject($subject);
    $mail->set_from($sender);
    foreach ($headers as $key => $value) {
        $mail->set_header($key, $value);
    }
    return $mail->send($recipients);
}
function send_html_mail($recipients, $sender, $subject, $html, $text = null, $headers = array())
{
    $mail = new mime_mail();
    //$text = convert_html_to_plain_text(preg_replace('(<p>|br>)', "\n", $html));
    $mail->set_html($html, $text);
    $mail->set_subject($subject);
    $mail->set_from($sender);
    foreach ($headers as $key => $value) {
        $mail->set_header($key, $value);
    }
    return $mail->send($recipients);
}