<?php
require_once "Mail.php";
include('Mail/mime.php');
include 'config.php';
include_once 'User.php';
use \User as User;

function send_mail(string $email, object $smtp, object $message, User $user = null) {
    include 'config.php';

    $crlf = "\r\n";

    $headers = array(
        'From' => $smtp->from,
        'To' => $email,
        'Subject' => $message->subject
    );

    if (isset($CC_MAIL)) {
        $headers['Cc'] = $CC_MAIL;
        $email .= ', ' . $CC_MAIL;
    }

    if (isset($BCC_MAIL)) {
        $email .= ', ' . $BCC_MAIL;
    }

    $smtp = Mail::factory('smtp', array(
            'host' => $smtp->host,
            'port' => $smtp->port,
            'auth' => true,
            'username' => $smtp->username, //your gmail account
            'password' => $smtp->password // your password
        ));

    // Creating the Mime message
    $mime = new Mail_mime(array(
        "text_charset" => "utf-8",
        "html_charset" => "utf-8",
        "eol" => $crlf
    ));

    // Setting the body of the email
    $mime->setTXTBody($message->text);
    $mime->setHTMLBody($message->html);
    if ($user && $user->invoice) {
        $mime->addAttachment ( $user->invoice , 'application/pdf' , $SERVICE_ACRONYM."-invoice.pdf" , false, "base64" );
    }

    $body = $mime->get();
    $headers = $mime->headers($headers);

    // Send the mail
    $mail = $smtp->send($email, $headers, $body);

    //check mail sent or not
    if (PEAR::isError($mail)) {
        return false;
    } else {
        return true;
    }
}

/* send_mail("mattf@tilde.club", $SMTP, (object) [ */
/*     "subject" => "Please confirm your email", */ 
/*     "text" => "Plain tet", */
/*     "html" => "<html><body><p>HTML message</p><h2>This is not mere text</h2></body></html>" */
/* ]) */
?>
