Class JMail
Email Class. Provides a common interface to send email from the Joomla!
Platform
-
PHPMailer
-
JMail
Methods summary
public
|
#
__construct( boolean $exceptions = true )
Constructor
Parameters
- $exceptions
boolean - $exceptions Flag if Exceptions should be thrown
Since
11.1
Overrides
|
public static
JMail
|
#
getInstance( string $id = 'Joomla', boolean $exceptions = true )
Returns the global email object, only creating it if it doesn't already
exist.
Returns the global email object, only creating it if it doesn't already
exist.
NOTE: If you need an instance to use that does not have the global
configuration values, use an id string that is not 'Joomla'.
Parameters
- $id
string - $id The id string for the JMail instance [optional]
- $exceptions
boolean - $exceptions Flag if Exceptions should be thrown [optional]
Returns
JMail
- The global JMail object
Since
11.1
|
public
boolean|JException
|
#
Send( )
Send the mail
Returns
boolean|JException - Boolean true if successful, boolean false if the mailonline
configuration is set to 0, or a JException object if the mail function does not
exist or sending the message fails.
Throws
Since
11.1
|
public
boolean
|
#
setFrom( string $address, string $name = '', boolean $auto = true )
Set the From and FromName properties.
Set the From and FromName properties.
Parameters
- $address
string - $address The sender email address
- $name
string - $name The sender name
- $auto
boolean - $auto Whether to also set the Sender address, defaults to true
Returns
boolean
Throws
Since
11.1
Overrides
|
public
JMail |boolean
|
#
setSender( mixed $from )
Set the email sender
Parameters
- $from
mixed - $from email address and Name of sender <span
class="php-keyword1">array</span>([<span
class="php-num">0</span>] => email Address, [<span
class="php-num">1</span>] => Name) or as a string
Returns
JMail |boolean
- Returns this object for chaining on success or boolean false on failure.
Throws
Since
11.1
|
public
JMail
|
#
setSubject( string $subject )
Set the email subject
Parameters
- $subject
string - $subject Subject of the email
Returns
JMail
- Returns this object for chaining.
Since
11.1
|
public
JMail
|
#
setBody( string $content )
Set the email body
Parameters
- $content
string - $content Body of the email
Returns
JMail
- Returns this object for chaining.
Since
11.1
|
protected
JMail |boolean
|
#
add( mixed $recipient, mixed $name = '', string $method = 'addAddress' )
Add recipients to the email.
Add recipients to the email.
Parameters
- $recipient
mixed - $recipient Either a string or array of strings [email address(es)]
- $name
mixed - $name Either a string or array of strings [name(s)]
- $method
string - $method The parent method's name.
Returns
JMail |boolean
- Returns this object for chaining on success or boolean false on failure.
Throws
Since
11.1
|
public
JMail |boolean
|
#
addRecipient( mixed $recipient, mixed $name = '' )
Add recipients to the email
Add recipients to the email
Parameters
- $recipient
mixed - $recipient Either a string or array of strings [email address(es)]
- $name
mixed - $name Either a string or array of strings [name(s)]
Returns
JMail |boolean
- Returns this object for chaining.
Since
11.1
|
public
JMail |boolean
|
#
addCc( mixed $cc, mixed $name = '' )
Add carbon copy recipients to the email
Add carbon copy recipients to the email
Parameters
- $cc
mixed - $cc Either a string or array of strings [email address(es)]
- $name
mixed - $name Either a string or array of strings [name(s)]
Returns
JMail |boolean
- Returns this object for chaining on success or boolean false on failure.
Since
11.1
|
public
JMail |boolean
|
#
addBcc( mixed $bcc, mixed $name = '' )
Add blind carbon copy recipients to the email
Add blind carbon copy recipients to the email
Parameters
- $bcc
mixed - $bcc Either a string or array of strings [email address(es)]
- $name
mixed - $name Either a string or array of strings [name(s)]
Returns
JMail |boolean
- Returns this object for chaining on success or boolean false on failure.
Since
11.1
|
public
JMail |boolean
|
#
addAttachment( mixed $path, mixed $name = '', mixed $encoding = 'base64', mixed $type = 'application/octet-stream', string $disposition = 'attachment' )
Add file attachment to the email
Add file attachment to the email
Parameters
- $path
mixed - $path Either a string or array of strings [filenames]
- $name
mixed - $name Either a string or array of strings [names]
- $encoding
mixed - $encoding The encoding of the attachment
- $type
mixed - $type The mime type
- $disposition
string - $disposition The disposition of the attachment
Returns
JMail |boolean
- Returns this object for chaining on success or boolean false on failure.
Throws
Since
12.2
Overrides
|
public
JMail
|
#
clearAttachments( )
Unset all file attachments from the email
Unset all file attachments from the email
Returns
JMail
- Returns this object for chaining.
Since
12.2
Overrides
|
public
JMail
|
#
removeAttachment( integer $index = 0 )
Unset file attachments specified by array index.
Unset file attachments specified by array index.
Parameters
- $index
integer - $index The numerical index of the attachment to remove
Returns
JMail
- Returns this object for chaining.
Since
12.2
|
public
JMail |boolean
|
#
addReplyTo( mixed $replyto, mixed $name = '' )
Add Reply to email address(es) to the email
Add Reply to email address(es) to the email
Parameters
- $replyto
mixed - $replyto Either a string or array of strings [email address(es)]
- $name
mixed - $name Either a string or array of strings [name(s)]
Returns
JMail |boolean
- Returns this object for chaining on success or boolean false on failure.
Since
11.1
Overrides
|
public
JMail
|
#
isHtml( boolean $ishtml = true )
Sets message type to HTML
Sets message type to HTML
Parameters
- $ishtml
boolean - $ishtml Boolean true or false.
Returns
JMail
- Returns this object for chaining.
Since
12.3
|
public
|
#
isSendmail( )
Send messages using $Sendmail.
Send messages using $Sendmail.
This overrides the parent class to remove the restriction on the executable's
name containing the word "sendmail"
Since
11.1
Overrides
|
public
boolean
|
#
useSendmail( string $sendmail = null )
Use sendmail for sending the email
Use sendmail for sending the email
Parameters
- $sendmail
string - $sendmail Path to sendmail [optional]
Returns
boolean - True on success
Since
11.1
|
public
boolean
|
#
useSmtp( string $auth = null, string $host = null, string $user = null, string $pass = null, string $secure = null, integer $port = 25 )
Use SMTP for sending the email
Use SMTP for sending the email
Parameters
- $auth
string - $auth SMTP Authentication [optional]
- $host
string - $host SMTP Host [optional]
- $user
string - $user SMTP Username [optional]
- $pass
string - $pass SMTP Password [optional]
- $secure
string - $secure Use secure methods
- $port
integer - $port The SMTP port
Returns
boolean - True on success
Since
11.1
|
public
boolean
|
#
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 )
Function to send an email
Function to send an email
Parameters
- $from
string - $from From email address
- $fromName
string - $fromName From name
- $recipient
mixed - $recipient Recipient email address(es)
- $subject
string - $subject email subject
- $body
string - $body Message body
- $mode
boolean - $mode false = plain text, true = HTML
- $cc
mixed - $cc CC email address(es)
- $bcc
mixed - $bcc BCC email address(es)
- $attachment
mixed - $attachment Attachment file name(s)
- $replyTo
mixed - $replyTo Reply to email address(es)
- $replyToName
mixed - $replyToName Reply to name(s)
Returns
boolean - True on success
Since
11.1
|
public
boolean
|
#
sendAdminMail( string $adminName, string $adminEmail, string $email, string $type, string $title, string $author, string $url = null )
Sends mail to administrator for approval of a user submission
Sends mail to administrator for approval of a user submission
Deprecated
4.0 Without replacement please implement it in your own code
Parameters
- $adminName
string - $adminName Name of administrator
- $adminEmail
string - $adminEmail Email address of administrator
- $email
string - $email [NOT USED TODO: Deprecate?]
- $type
string - $type Type of item to approve
- $title
string - $title Title of item to approve
- $author
string - $author Author of item to approve
- $url
string - $url A URL to included in the mail
Returns
boolean - True on success
Since
11.1
|
Methods inherited from PHPMailer
DKIM_Add()
,
DKIM_BodyC()
,
DKIM_HeaderC()
,
DKIM_QP()
,
DKIM_Sign()
,
__destruct()
,
_mime_types()
,
addAddress()
,
addAnAddress()
,
addBCC()
,
addCC()
,
addCustomHeader()
,
addEmbeddedImage()
,
addOrEnqueueAnAddress()
,
addStringAttachment()
,
addStringEmbeddedImage()
,
addrAppend()
,
addrFormat()
,
alternativeExists()
,
attachAll()
,
attachmentExists()
,
base64EncodeWrapMB()
,
clearAddresses()
,
clearAllRecipients()
,
clearBCCs()
,
clearCCs()
,
clearCustomHeaders()
,
clearQueuedAddresses()
,
clearReplyTos()
,
createBody()
,
createHeader()
,
doCallback()
,
edebug()
,
encodeFile()
,
encodeHeader()
,
encodeQ()
,
encodeQP()
,
encodeQPphp()
,
encodeString()
,
endBoundary()
,
filenameToType()
,
fixEOL()
,
generateId()
,
getAllRecipientAddresses()
,
getAttachments()
,
getBccAddresses()
,
getBoundary()
,
getCcAddresses()
,
getCustomHeaders()
,
getLastMessageID()
,
getMailMIME()
,
getReplyToAddresses()
,
getSMTPInstance()
,
getSentMIMEMessage()
,
getToAddresses()
,
getTranslations()
,
has8bitChars()
,
hasLineLongerThanMax()
,
hasMultiBytes()
,
headerLine()
,
html2text()
,
idnSupported()
,
inlineImageExists()
,
isError()
,
isHTML()
,
isMail()
,
isQmail()
,
isSMTP()
,
isShellSafe()
,
lang()
,
mailSend()
,
mb_pathinfo()
,
msgHTML()
,
normalizeBreaks()
,
parseAddresses()
,
postSend()
,
preSend()
,
punyencodeAddress()
,
rfcDate()
,
secureHeader()
,
send()
,
sendmailSend()
,
serverHostname()
,
set()
,
setError()
,
setLanguage()
,
setMessageType()
,
setWordWrap()
,
sign()
,
smtpClose()
,
smtpConnect()
,
smtpSend()
,
textLine()
,
utf8CharBoundary()
,
validateAddress()
,
wrapText()
Magic methods summary
Constants summary
Constants inherited from PHPMailer
CRLF
,
MAX_LINE_LENGTH
,
STOP_CONTINUE
,
STOP_CRITICAL
,
STOP_MESSAGE
Properties summary
protected static
JMail[]
|
$instances
|
#
JMail instances container.
JMail instances container.
Since
11.3
|
public
string
|
$CharSet
|
#
Charset of the message.
Since
11.1
|
Properties inherited from PHPMailer
$AllowEmpty
,
$AltBody
,
$AuthType
,
$Body
,
$ConfirmReadingTo
,
$ContentType
,
$CustomHeader
,
$DKIM_domain
,
$DKIM_identity
,
$DKIM_passphrase
,
$DKIM_private
,
$DKIM_private_string
,
$DKIM_selector
,
$Debugoutput
,
$Encoding
,
$ErrorInfo
,
$From
,
$FromName
,
$Helo
,
$Host
,
$Hostname
,
$Ical
,
$LE
,
$MIMEBody
,
$MIMEHeader
,
$Mailer
,
$MessageDate
,
$MessageID
,
$Password
,
$PluginDir
,
$Port
,
$Priority
,
$Realm
,
$RecipientsQueue
,
$ReplyTo
,
$ReplyToQueue
,
$ReturnPath
,
$SMTPAuth
,
$SMTPAutoTLS
,
$SMTPDebug
,
$SMTPKeepAlive
,
$SMTPOptions
,
$SMTPSecure
,
$Sender
,
$Sendmail
,
$SingleTo
,
$SingleToArray
,
$Subject
,
$Timeout
,
$UseSendmailOptions
,
$Username
,
$Version
,
$WordWrap
,
$Workstation
,
$XMailer
,
$action_function
,
$all_recipients
,
$attachment
,
$bcc
,
$boundary
,
$cc
,
$do_verp
,
$error_count
,
$exceptions
,
$language
,
$lastMessageID
,
$mailHeader
,
$message_type
,
$sign_cert_file
,
$sign_extracerts_file
,
$sign_key_file
,
$sign_key_pass
,
$smtp
,
$to
,
$uniqueid
,
$validator