API15

API15:JMail/getInstance

From Joomla! Documentation

Description

Returns a reference to a global e-mail object, only creating it if it doesn't already exist.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

& getInstance($id= 'Joomla')
Parameter Name Default Value Description
$id 'Joomla' $id The id string for the instance [optional]

Returns

object The global object

Defined in

libraries/joomla/mail/mail.php

Importing

jimport( 'joomla.mail.mail' );

Source Body

function & getInstance($id = 'Joomla')
{
        static $instances;

        if (!isset ($instances)) {
                $instances = array ();
        }

        if (empty ($instances[$id])) {
                $instances[$id] = new JMail();
        }

        return $instances[$id];
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples