API16

JMail/useSMTP

From Joomla! Documentation

< API16:JMail

The "API16" 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]

Use SMTP for sending the e-mail



Syntax[edit]

useSMTP($auth=null, $host=null, $user=null, $pass=null, $secure=null, $port=25)
Parameter Name Default Value Description
$auth null $auth SMTP Authentication [optional]
$host null $host SMTP Host [optional]
$user null $user SMTP Username [optional]
$pass null $pass SMTP Password [optional]
$secure null
$port 25

Returns[edit]

boolean True on success

Defined in[edit]

libraries/joomla/mail/mail.php

Importing[edit]

jimport( 'joomla.mail.mail' );

Source Body[edit]

public function useSMTP($auth = null, $host = null, $user = null, $pass = null, $secure = null, $port = 25)
{
        $this->SMTPAuth = $auth;
        $this->Host             = $host;
        $this->Username = $user;
        $this->Password = $pass;
        $this->Port             = $port;

        if ($secure == 'ssl' || $secure == 'tls') {
                $this->SMTPSecure = $secure;
        }

        if ($this->SMTPAuth !== null && $this->Host !== null && $this->Username !== null && $this->Password !== null) {
                $this->IsSMTP();
                return true;
        } else {
                $this->IsMail();
                return false;
        }
}



Examples[edit]

Code Examples[edit]