Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions fEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,29 @@ class fEmail
*/
static private $popen_sendmail = FALSE;

/**
* The fSMTP connection to use for all instances of fEmail.
* @var fSMTP
*/
static private $connection = NULL;

/**
* Sets the fSMTP connection all instances of fEmail will use.
* @var fSMTP
*/
static public function setConnection(fSMTP $connection)
{
static::$connection = $connection;
}

/**
* returns the fSMTP connection or null if it's not set.
* @return null|fSMTP
*/
public function getConnection()
{
return static::$connection;
}

/**
* Turns a name and email into a `"name" <email>` string, or just `email` if no name is provided
Expand Down Expand Up @@ -1337,6 +1360,10 @@ public function send($connection=NULL)
{
$this->validate();

if (static::getConnection() && !$connection) {
$connection = static::getConnection();
}

$message_id = '<' . fCryptography::randomString(10, 'hexadecimal') . '.' . time() . '@' . self::getFQDN() . '>';

// The mail() function on Windows doesn't support names in headers so
Expand Down