JMail
Extends \PHPMailerEmail Class. Provides a common interface to send email from the Joomla! Platform
package |
Joomla.Platform |
---|---|
subpackage |
|
since |
11.1 |
Methods
__construct
Constructor
__construct()
addAttachment
Add file attachments to the email
addAttachment(mixed $attachment, mixed $name = '', mixed $encoding = 'base64', mixed $type = 'application/octet-stream') : \JMail
since |
11.1 |
---|
Arguments
- $attachment
mixed
Either a string or array of strings [filenames]- $name
mixed
Either a string or array of strings [names]- $encoding
mixed
The encoding of the attachment- $type
mixed
The mime type
Response
\JMail
Returns this object for chaining.
addBCC
Add blind carbon copy recipients to the email
addBCC(mixed $bcc, mixed $name = '') : \JMail
since |
11.1 |
---|
Arguments
- $bcc
mixed
Either a string or array of strings [email address(es)]- $name
mixed
Either a string or array of strings [name(s)]
Response
\JMail
Returns this object for chaining.
addCC
Add carbon copy recipients to the email
addCC(mixed $cc, mixed $name = '') : \JMail
since |
11.1 |
---|
Arguments
- $cc
mixed
Either a string or array of strings [email address(es)]- $name
mixed
Either a string or array of strings [name(s)]
Response
\JMail
Returns this object for chaining.
addRecipient
Add recipients to the email
addRecipient(mixed $recipient, mixed $name = '') : \JMail
since |
11.1 |
---|
Arguments
- $recipient
mixed
Either a string or array of strings [email address(es)]- $name
mixed
Either a string or array of strings [name(s)]
Response
\JMail
Returns this object for chaining.
addReplyTo
Add Reply to email address(es) to the email
addReplyTo(array $replyto, mixed $name = '') : \JMail
since |
11.1 |
---|
Arguments
- $replyto
array
Either an array or multi-array of formarray([0] => email Address [1] => Name)
- $name
mixed
Either an array or single string
Response
\JMail
Returns this object for chaining.
getInstance
Returns the global email object, only creating it if it doesn't already exist.
getInstance(string $id = 'Joomla') : \JMail
NOTE: If you need an instance to use that does not have the global configuration values, use an id string that is not 'Joomla'.
since |
11.1 |
---|
Arguments
- $id
string
The id string for the JMail instance [optional]
Response
\JMail
The global JMail object
Send
Send the mail
Send() : mixed
since |
11.1 |
---|
Response
mixed
True if successful, a JError object otherwise
sendAdminMail
Sends mail to administrator for approval of a user submission
sendAdminMail(string $adminName, string $adminEmail, string $email, string $type, string $title, string $author, string $url = null) : boolean
since |
11.1 |
---|
Arguments
- $adminName
string
Name of administrator- $adminEmail
string
Email address of administratorstring
[NOT USED TODO: Deprecate?]- $type
string
Type of item to approve- $title
string
Title of item to approve- $author
string
Author of item to approve- $url
string
A URL to included in the mail
Response
boolean
True on success
sendMail
Function to send an email
sendMail(string $from, string $fromName, mixed $recipient, string $subject, string $body, boolean $mode = false, mixed $cc = null, mixed $bcc = null, mixed $attachment = null, mixed $replyTo = null, mixed $replyToName = null) : boolean
since |
11.1 |
---|
Arguments
- $from
string
From email address- $fromName
string
From name- $recipient
mixed
Recipient email address(es)- $subject
string
email subject- $body
string
Message body- $mode
boolean
false = plain text, true = HTML- $cc
mixed
CC email address(es)- $bcc
mixed
BCC email address(es)- $attachment
mixed
Attachment file name(s)- $replyTo
mixed
Reply to email address(es)- $replyToName
mixed
Reply to name(s)
Response
boolean
True on success
setBody
Set the email body
setBody(string $content) : \JMail
since |
11.1 |
---|
Arguments
- $content
string
Body of the email
Response
\JMail
Returns this object for chaining.
setSender
Set the email sender
setSender(array $from) : \JMail
since |
11.1 |
---|
Arguments
- $from
array
email address and Name of senderarray([0] => email Address [1] => Name)
Response
\JMail
Returns this object for chaining.
setSubject
Set the email subject
setSubject(string $subject) : \JMail
since |
11.1 |
---|
Arguments
- $subject
string
Subject of the email
Response
\JMail
Returns this object for chaining.
useSendmail
Use sendmail for sending the email
useSendmail(string $sendmail = null) : boolean
since |
11.1 |
---|
Arguments
- $sendmail
string
Path to sendmail [optional]
Response
boolean
True on success
useSMTP
Use SMTP for sending the email
useSMTP(string $auth = null, string $host = null, string $user = null, string $pass = null, string $secure = null, integer $port = 25) : boolean
since |
11.1 |
---|
Arguments
- $auth
string
SMTP Authentication [optional]- $host
string
SMTP Host [optional]- $user
string
SMTP Username [optional]- $pass
string
SMTP Password [optional]- $secure
string
Use secure methods- $port
integer
The SMTP port
Response
boolean
True on success
Properties
instances
JMail instances container.
since |
11.3 |
---|
Type(s)
array
CharSet
Charset of the message.
since |
11.1 |
---|
Type(s)
string