Actions

API16

JMail/getInstance

From Joomla! Documentation

< API16:JMail
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

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

[Edit Descripton]

Description:JMail/getInstance

Syntax

static 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

public static 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] SeeAlso:JMail/getInstance

Examples

<CodeExamplesForm />