<commit_before><?php
/**
 * $Id$
 *
 * Util class to send email messages
 *
 * MIME attachments:                 http://tools.ietf.org/html/rfc2231
 * MIME message bodies:              http://tools.ietf.org/html/rfc2045
 * MIME media types & multipart:     http://tools.ietf.org/html/rfc2046
 * MIME header Content-Disposition:  http://tools.ietf.org/html/rfc2183
 * MIME validator:                   http://www.apps.ietf.org/msglint.html
 *
 * @author <NAME>, 2008-2011 <<EMAIL>>
 */

//STATUS: wip

//TODO: untangle smtp class, create a new connect() method

require_once('class.CoreBase.php');
require_once('SmtpClient.php');
require_once('network.php'); //for is_email()
require_once('files.php'); //for file_get_mime_by_suffix()

class MailAttachment
{
    var $data;
    var $filename;
    var $content_id = ''; //set for embedded images
    var $mimetype;
}

class SendMail extends CoreBase
{
    protected static $_instance; ///< singleton

    protected $smtp;
    protected $version            = 'core_dev Sendmail 0.9';
    protected $connected          = false;

    protected static $from_adr, $from_name;
    protected static $rply_adr, $rply_name;
    protected static $subject;
    protected static $to_adr      = array();
    protected static $cc_adr      = array();
    protected static $bcc_adr     = array();
    protected static $html        = false;
    protected static $attachments = array();  ///< MailAttachment objects

    private function __construct()
    {
        set_time_limit(0);
    }

    private function __clone() {}      //singleton: prevent cloning of class

    public static function getInstance()
    {
        if (!(self::$_instance instanceof self))
            self::$_instance = new self();

        self::resetInstance();

        return self::$_instance;
    }

    protected static function resetInstance()
    {
        self::$from_adr = '';
        self::$from_name = '';
        self::$rply_adr = '';
        self::$rply_name = '';
        self::$subject = '';
        self::$to_adr = array();
        self::$cc_adr = array();
        self::$bcc_adr = array();;<commit_msg>dont reset from & reply-to data<commit_after><?php
/**
 * $Id$
 *
 * Util class to send email messages
 *
 * MIME attachments:                 http://tools.ietf.org/html/rfc2231
 * MIME message bodies:              http://tools.ietf.org/html/rfc2045
 * MIME media types & multipart:     http://tools.ietf.org/html/rfc2046
 * MIME header Content-Disposition:  http://tools.ietf.org/html/rfc2183
 * MIME validator:                   http://www.apps.ietf.org/msglint.html
 *
 * @author <NAME>, 2008-2011 <<EMAIL>>
 */

//STATUS: wip

//TODO: untangle smtp class, create a new connect() method

require_once('class.CoreBase.php');
require_once('SmtpClient.php');
require_once('network.php'); //for is_email()
require_once('files.php'); //for file_get_mime_by_suffix()

class MailAttachment
{
    var $data;
    var $filename;
    var $content_id = ''; //set for embedded images
    var $mimetype;
}

class SendMail extends CoreBase
{
    protected static $_instance; ///< singleton

    protected $smtp;
    protected $version            = 'core_dev Sendmail 0.9';
    protected $connected          = false;

    protected static $from_adr, $from_name;
    protected static $rply_adr, $rply_name;
    protected static $subject;
    protected static $to_adr      = array();
    protected static $cc_adr      = array();
    protected static $bcc_adr     = array();
    protected static $html        = false;
    protected static $attachments = array();  ///< MailAttachment objects

    private function __construct()
    {
        set_time_limit(0);
    }

    private function __clone() {}      //singleton: prevent cloning of class

    public static function getInstance()
    {
        if (!(self::$_instance instanceof self))
            self::$_instance = new self();

        self::resetInstance();

        return self::$_instance;
    }

    protected static function resetInstance()
    {
//        self::$from_adr = '';
//        self::$from_name = '';
//        self::$rply_adr = '';
//        self::$rply_name = '';
        self::$subject = '';
        self::$to_adr = array();
        self::$cc_adr = array();
        self::$bcc_adr = array();;
{'fraction_non_alphanumeric': 0.13738317757009347, 'fraction_numerical': 0.012616822429906542, 'mean_word_length': 2.5586034912718203, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3288257', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1283, 'n_words': 315}