public static \Joomla\CMS\Mail\Mail
(mixed $id = 'Joomla', mixed $exceptions = true)
Returns the global email object, only creating it if it doesn't already exist.
Parameters
- string  $id  The id string for the Mail instance [optional]
 - bool  $exceptions  Flag if Exceptions should be thrown [optional]
 
Returns
- \Joomla\CMS\Mail\Mail The global Mail object
 
Since
protected \Joomla\CMS\Mail\Mail|bool
(mixed $recipient, mixed $name = '', mixed $method = 'addAddress')
Add recipients to the email.
Parameters
- mixed  $recipient  Either a string or array of strings [email address(es)]
 - mixed  $name  Either a string or array of strings [name(s)]
 - string  $method  The parent method's name.
 
Returns
- \Joomla\CMS\Mail\Mail|bool Returns this object for chaining on success or boolean false on failure.
 
Since
-
- \InvalidArgumentException if the argument array counts do not match
 - \PHPMailer\PHPMailer\Exception if setting the address failed and exception throwing is enabled
 
public \Joomla\CMS\Mail\Mail|bool
(mixed $path, mixed $name = '', mixed $encoding = 'base64', mixed $type = 'application/octet-stream', mixed $disposition = 'attachment')
Add file attachment to the email
Parameters
- mixed  $path  Either a string or array of strings [filenames]
 - mixed  $name  Either a string or array of strings [names]. N.B. if this is an array it must contain the same
number of elements as the array of paths supplied.
 - mixed  $encoding  The encoding of the attachment
 - mixed  $type  The mime type
 - string  $disposition  The disposition of the attachment
 
Returns
- \Joomla\CMS\Mail\Mail|bool Returns this object for chaining on success or boolean false on failure when exception throwing is disabled.
 
Since
-
- \InvalidArgumentException if the argument array counts do not match
 - \PHPMailer\PHPMailer\Exception if setting the attachment failed and exception throwing is enabled
 
public bool
(mixed $auth = null, mixed $host = null, mixed $user = null, mixed $pass = null, mixed $secure = null, mixed $port = 25)
Use SMTP for sending the email
Parameters
- string  $auth  SMTP Authentication [optional]
 - string  $host  SMTP Host [optional]
 - string  $user  SMTP Username [optional]
 - string  $pass  SMTP Password [optional]
 - string  $secure  Use secure methods
 - int  $port  The SMTP port
 
Returns
Since
public bool
(mixed $from, mixed $fromName, mixed $recipient, mixed $subject, mixed $body, mixed $mode = false, mixed $cc = null, mixed $bcc = null, mixed $attachment = null, mixed $replyTo = null, mixed $replyToName = null)
Function to send an email
Parameters
- string  $from  From email address
 - string  $fromName  From name
 - mixed  $recipient  Recipient email address(es)
 - string  $subject  email subject
 - string  $body  Message body
 - bool  $mode  false = plain text, true = HTML
 - mixed  $cc  CC email address(es)
 - mixed  $bcc  BCC email address(es)
 - mixed  $attachment  Attachment file name(s)
 - mixed  $replyTo  Reply to email address(es)
 - mixed  $replyToName  Reply to name(s)
 
Returns
- bool True on success, false on failure when exception throwing is disabled.
 
Since
-
- \Joomla\CMS\Mail\Exception\MailDisabledException if the mail function is disabled
 - \PHPMailer\PHPMailer\Exception if exception throwing is enabled