JMail/getInstance
From Joomla! Documentation
< API15:JMail
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Returns a reference to a global e-mail object, only creating it if it doesn't already exist.
Template:Description:JMail/getInstance
Syntax[edit]
& getInstance($id= 'Joomla')
Parameter Name | Default Value | Description |
---|---|---|
$id | 'Joomla' | $id The id string for the instance [optional] |
Returns[edit]
object The global object
Defined in[edit]
libraries/joomla/mail/mail.php
Importing[edit]
jimport( 'joomla.mail.mail' );
Source Body[edit]
function & getInstance($id = 'Joomla')
{
static $instances;
if (!isset ($instances)) {
$instances = array ();
}
if (empty ($instances[$id])) {
$instances[$id] = new JMail();
}
return $instances[$id];
}
[Edit See Also] Template:SeeAlso:JMail/getInstance
Examples[edit]
<CodeExamplesForm />