Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JMail
+ Graphe d'héritage de JMail:
+ Graphe de collaboration de JMail:

Liste de tous les membres

Fonctions membres publiques

 __construct ()
 Send ()
 setSender ($from)
 setSubject ($subject)
 setBody ($content)
 addRecipient ($recipient, $name= '')
 addCC ($cc, $name= '')
 addBCC ($bcc, $name= '')
 addAttachment ($attachment, $name= '', $encoding= 'base64', $type= 'application/octet-stream')
 addReplyTo ($replyto, $name= '')
 isHtml ($ishtml=true)
 useSendmail ($sendmail=null)
 useSMTP ($auth=null, $host=null, $user=null, $pass=null, $secure=null, $port=25)
 sendMail ($from, $fromName, $recipient, $subject, $body, $mode=false, $cc=null, $bcc=null, $attachment=null, $replyTo=null, $replyToName=null)
 sendAdminMail ($adminName, $adminEmail, $email, $type, $title, $author, $url=null)
- Fonctions membres publiques inherited from PHPMailer
 __construct ($exceptions=false)
 __destruct ()
 IsHTML ($ishtml=true)
 IsSMTP ()
 IsMail ()
 IsSendmail ()
 IsQmail ()
 AddAddress ($address, $name= '')
 AddCC ($address, $name= '')
 AddBCC ($address, $name= '')
 AddReplyTo ($address, $name= '')
 SetFrom ($address, $name= '', $auto=true)
 PreSend ()
 PostSend ()
 SmtpConnect ($options=array())
 SmtpClose ()
 SetLanguage ($langcode= 'en', $lang_path= 'language/')
 GetTranslations ()
 AddrAppend ($type, $addr)
 AddrFormat ($addr)
 WrapText ($message, $length, $qp_mode=false)
 UTF8CharBoundary ($encodedText, $maxLength)
 SetWordWrap ()
 CreateHeader ()
 GetMailMIME ()
 GetSentMIMEMessage ()
 CreateBody ()
 HeaderLine ($name, $value)
 TextLine ($value)
 AddAttachment ($path, $name= '', $encoding= 'base64', $type= '')
 GetAttachments ()
 EncodeString ($str, $encoding= 'base64')
 EncodeHeader ($str, $position= 'text')
 HasMultiBytes ($str)
 Base64EncodeWrapMB ($str, $lf=null)
 EncodeQP ($string, $line_max=76)
 EncodeQPphp ($string, $line_max=76, $space_conv=false)
 EncodeQ ($str, $position= 'text')
 AddStringAttachment ($string, $filename, $encoding= 'base64', $type= '')
 AddEmbeddedImage ($path, $cid, $name= '', $encoding= 'base64', $type= '')
 AddStringEmbeddedImage ($string, $cid, $name= '', $encoding= 'base64', $type= '')
 InlineImageExists ()
 AttachmentExists ()
 AlternativeExists ()
 ClearAddresses ()
 ClearCCs ()
 ClearBCCs ()
 ClearReplyTos ()
 ClearAllRecipients ()
 ClearAttachments ()
 ClearCustomHeaders ()
 IsError ()
 FixEOL ($str)
 AddCustomHeader ($name, $value=null)
 MsgHTML ($message, $basedir= '', $advanced=false)
 html2text ($html, $advanced=false)
 set ($name, $value= '')
 SecureHeader ($str)
 Sign ($cert_filename, $key_filename, $key_pass)
 DKIM_QP ($txt)
 DKIM_Sign ($s)
 DKIM_HeaderC ($s)
 DKIM_BodyC ($body)
 DKIM_Add ($headers_line, $subject, $body)

Fonctions membres publiques statiques

static getInstance ($id= 'Joomla')
- Fonctions membres publiques statiques inherited from PHPMailer
static ValidateAddress ($address)
static RFCDate ()
static _mime_types ($ext= '')
static filenameToType ($filename)
static mb_pathinfo ($path, $options=null)
static NormalizeBreaks ($text, $breaktype="\r\n")

Attributs publics

 $CharSet = 'utf-8'
- Attributs publics inherited from PHPMailer
 $Priority = 3
 $ContentType = 'text/plain'
 $Encoding = '8bit'
 $ErrorInfo = ''
 $From = 'root@localhost'
 $FromName = 'Root User'
 $Sender = ''
 $ReturnPath = ''
 $Subject = ''
 $Body = ''
 $AltBody = ''
 $Ical = ''
 $WordWrap = 0
 $Mailer = 'mail'
 $Sendmail = '/usr/sbin/sendmail'
 $UseSendmailOptions = true
 $PluginDir = ''
 $ConfirmReadingTo = ''
 $Hostname = ''
 $MessageID = ''
 $MessageDate = ''
 $Host = 'localhost'
 $Port = 25
 $Helo = ''
 $SMTPSecure = ''
 $SMTPAuth = false
 $Username = ''
 $Password = ''
 $AuthType = ''
 $Realm = ''
 $Workstation = ''
 $Timeout = 10
 $SMTPDebug = false
 $Debugoutput = "echo"
 $SMTPKeepAlive = false
 $SingleTo = false
 $do_verp = false
 $SingleToArray = array()
 $AllowEmpty = false
 $LE = "\n"
 $DKIM_selector = ''
 $DKIM_identity = ''
 $DKIM_passphrase = ''
 $DKIM_domain = ''
 $DKIM_private = ''
 $action_function = ''
 $Version = '5.2.6'
 $XMailer = ''
const STOP_MESSAGE = 0
const STOP_CONTINUE = 1
const STOP_CRITICAL = 2
const CRLF = "\r\n"

Fonctions membres protégées

 add ($recipient, $name= '', $method= 'AddAddress')
- Fonctions membres protégées inherited from PHPMailer
 edebug ($str)
 AddAnAddress ($kind, $address, $name= '')
 SendmailSend ($header, $body)
 MailSend ($header, $body)
 SmtpSend ($header, $body)
 GetBoundary ($boundary, $charSet, $contentType, $encoding)
 EndBoundary ($boundary)
 SetMessageType ()
 AttachAll ($disposition_type, $boundary)
 EncodeFile ($path, $encoding= 'base64')
 SetError ($msg)
 ServerHostname ()
 Lang ($key)
 doCallback ($isSent, $to, $cc, $bcc, $subject, $body, $from=null)

Attributs protégés statiques

static $instances = array()

Additional Inherited Members

- Attributs protégés inherited from PHPMailer
 $MIMEBody = ''
 $MIMEHeader = ''
 $mailHeader = ''
 $smtp = null
 $to = array()
 $cc = array()
 $bcc = array()
 $ReplyTo = array()
 $all_recipients = array()
 $attachment = array()
 $CustomHeader = array()
 $message_type = ''
 $boundary = array()
 $language = array()
 $error_count = 0
 $sign_cert_file = ''
 $sign_key_file = ''
 $sign_key_pass = ''
 $exceptions = false

Description détaillée

Définition à la ligne 21 du fichier mail.php.


Documentation des constructeurs et destructeur

JMail::__construct ( )

Constructor

Depuis:
11.1

Définition à la ligne 40 du fichier mail.php.

{
// PHPMailer has an issue using the relative path for its language files
$this->SetLanguage('joomla', JPATH_PLATFORM . '/phpmailer/language/');
}

Documentation des fonctions membres

JMail::add (   $recipient,
  $name = '',
  $method = 'AddAddress' 
)
protected

Add recipients to the email.

Paramètres:
mixed$recipientEither a string or array of strings [email address(es)]
mixed$nameEither a string or array of strings [name(s)]
string$methodThe parent method's name.
Renvoie:
JMail Returns this object for chaining.
Depuis:
11.1
Exceptions:
InvalidArgumentException

Définition à la ligne 208 du fichier mail.php.

Références JMailHelper\cleanLine().

{
// If the recipient is an array, add each recipient... otherwise just add the one
if (is_array($recipient))
{
if (is_array($name))
{
$combined = array_combine($recipient, $name);
if ($combined === false)
{
throw new InvalidArgumentException("The number of elements for each array isn't equal.");
}
foreach ($combined as $recipientEmail => $recipientName)
{
$recipientEmail = JMailHelper::cleanLine($recipientEmail);
$recipientName = JMailHelper::cleanLine($recipientName);
call_user_func('parent::' . $method, $recipientEmail, $recipientName);
}
}
else
{
$name = JMailHelper::cleanLine($name);
foreach ($recipient as $to)
{
call_user_func('parent::' . $method, $to, $name);
}
}
}
else
{
$recipient = JMailHelper::cleanLine($recipient);
call_user_func('parent::' . $method, $recipient, $name);
}
return $this;
}

+ Voici le graphe d'appel pour cette fonction :

JMail::addAttachment (   $attachment,
  $name = '',
  $encoding = 'base64',
  $type = 'application/octet-stream' 
)

Add file attachments to the email

Paramètres:
mixed$attachmentEither a string or array of strings [filenames]
mixed$nameEither a string or array of strings [names]
mixed$encodingThe encoding of the attachment
mixed$typeThe mime type
Renvoie:
JMail Returns this object for chaining.
Depuis:
12.2
Exceptions:
InvalidArgumentException

Définition à la ligne 321 du fichier mail.php.

{
// If the file attachments is an array, add each file... otherwise just add the one
if (isset($attachment))
{
if (is_array($attachment))
{
if (!empty($name) && count($attachment) != count($name))
{
throw new InvalidArgumentException("The number of attachments must be equal with the number of name");
}
foreach ($attachment as $key => $file)
{
if (!empty($name))
{
parent::AddAttachment($file, $name[$key], $encoding, $type);
}
else
{
parent::AddAttachment($file, $name, $encoding, $type);
}
}
}
else
{
parent::AddAttachment($attachment, $name, $encoding, $type);
}
}
return $this;
}
JMail::addBCC (   $bcc,
  $name = '' 
)

Add blind carbon copy recipients to the email

Paramètres:
mixed$bccEither a string or array of strings [email address(es)]
mixed$nameEither a string or array of strings [name(s)]
Renvoie:
JMail Returns this object for chaining.
Depuis:
11.1

Définition à la ligne 297 du fichier mail.php.

{
// If the blind carbon copy recipient is an array, add each recipient... otherwise just add the one
if (isset($bcc))
{
$this->add($bcc, $name, 'AddBCC');
}
return $this;
}
JMail::addCC (   $cc,
  $name = '' 
)

Add carbon copy recipients to the email

Paramètres:
mixed$ccEither a string or array of strings [email address(es)]
mixed$nameEither a string or array of strings [name(s)]
Renvoie:
JMail Returns this object for chaining.
Depuis:
11.1

Définition à la ligne 276 du fichier mail.php.

{
// If the carbon copy recipient is an array, add each recipient... otherwise just add the one
if (isset($cc))
{
$this->add($cc, $name, 'AddCC');
}
return $this;
}
JMail::addRecipient (   $recipient,
  $name = '' 
)

Add recipients to the email

Paramètres:
mixed$recipientEither a string or array of strings [email address(es)]
mixed$nameEither a string or array of strings [name(s)]
Renvoie:
JMail Returns this object for chaining.
Depuis:
11.1

Définition à la ligne 259 du fichier mail.php.

{
$this->add($recipient, $name, 'AddAddress');
return $this;
}
JMail::addReplyTo (   $replyto,
  $name = '' 
)

Add Reply to email address(es) to the email

Paramètres:
mixed$replytoEither a string or array of strings [email address(es)]
mixed$nameEither a string or array of strings [name(s)]
Renvoie:
JMail Returns this object for chaining.
Depuis:
11.1

Définition à la ligne 364 du fichier mail.php.

{
$this->add($replyto, $name, 'AddReplyTo');
return $this;
}
static JMail::getInstance (   $id = 'Joomla')
static

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'.

Paramètres:
string$idThe id string for the JMail instance [optional]
Renvoie:
JMail The global JMail object
Depuis:
11.1

Définition à la ligne 59 du fichier mail.php.

Référencé par JFactory\createMailer().

{
if (empty(self::$instances[$id]))
{
self::$instances[$id] = new JMail;
}
return self::$instances[$id];
}

+ Voici le graphe des appelants de cette fonction :

JMail::isHtml (   $ishtml = true)

Sets message type to HTML

Paramètres:
boolean$ishtmlBoolean true or false.
Renvoie:
JMail Returns this object for chaining.
Depuis:
12.3

Définition à la ligne 380 du fichier mail.php.

{
parent::IsHTML($ishtml);
return $this;
}
JMail::Send ( )

Send the mail

Renvoie:
mixed True if successful; JError if using legacy tree (no exception thrown in that case).
Depuis:
11.1
Exceptions:
RuntimeException

Réimplémentée à partir de PHPMailer.

Définition à la ligne 77 du fichier mail.php.

Références JText\_(), JFactory\getApplication(), JFactory\getConfig(), et JError\raiseNotice().

{
if (JFactory::getConfig()->get('mailonline'))
{
if (($this->Mailer == 'mail') && !function_exists('mail'))
{
if (class_exists('JError'))
{
return JError::raiseNotice(500, JText::_('JLIB_MAIL_FUNCTION_DISABLED'));
}
else
{
throw new RuntimeException(sprintf('%s::Send mail not enabled.', get_class($this)));
}
}
@$result = parent::Send();
if ($result == false)
{
if (class_exists('JError'))
{
$result = JError::raiseNotice(500, JText::_($this->ErrorInfo));
}
else
{
throw new RuntimeException(sprintf('%s::Send failed: "%s".', get_class($this), $this->ErrorInfo));
}
}
return $result;
}
else
{
JFactory::getApplication()->enqueueMessage(JText::_('JLIB_MAIL_FUNCTION_OFFLINE'));
return false;
}
}

+ Voici le graphe d'appel pour cette fonction :

JMail::sendAdminMail (   $adminName,
  $adminEmail,
  $email,
  $type,
  $title,
  $author,
  $url = null 
)

Sends mail to administrator for approval of a user submission

Paramètres:
string$adminNameName of administrator
string$adminEmailEmail address of administrator
string$email[NOT USED TODO: Deprecate?]
string$typeType of item to approve
string$titleTitle of item to approve
string$authorAuthor of item to approve
string$urlA URL to included in the mail
Renvoie:
boolean True on success
Depuis:
11.1

Définition à la ligne 529 du fichier mail.php.

Références JText\_(), et JText\sprintf().

{
$subject = JText::sprintf('JLIB_MAIL_USER_SUBMITTED', $type);
$message = sprintf(JText::_('JLIB_MAIL_MSG_ADMIN'), $adminName, $type, $title, $author, $url, $url, 'administrator', $type);
$message .= JText::_('JLIB_MAIL_MSG') . "\n";
$this->addRecipient($adminEmail);
$this->setSubject($subject);
$this->setBody($message);
return $this->Send();
}

+ Voici le graphe d'appel pour cette fonction :

JMail::sendMail (   $from,
  $fromName,
  $recipient,
  $subject,
  $body,
  $mode = false,
  $cc = null,
  $bcc = null,
  $attachment = null,
  $replyTo = null,
  $replyToName = null 
)

Function to send an email

Paramètres:
string$fromFrom email address
string$fromNameFrom name
mixed$recipientRecipient email address(es)
string$subjectemail subject
string$bodyMessage body
boolean$modefalse = plain text, true = HTML
mixed$ccCC email address(es)
mixed$bccBCC email address(es)
mixed$attachmentAttachment file name(s)
mixed$replyToReply to email address(es)
mixed$replyToNameReply to name(s)
Renvoie:
boolean True on success
Depuis:
11.1

Définition à la ligne 475 du fichier mail.php.

{
$this->setSubject($subject);
$this->setBody($body);
// Are we sending the email as HTML?
if ($mode)
{
$this->IsHTML(true);
}
$this->addRecipient($recipient);
$this->addCC($cc);
$this->addBCC($bcc);
// Take care of reply email addresses
if (is_array($replyTo))
{
$numReplyTo = count($replyTo);
for ($i = 0; $i < $numReplyTo; $i++)
{
$this->addReplyTo(array($replyTo[$i], $replyToName[$i]));
}
}
elseif (isset($replyTo))
{
$this->addReplyTo(array($replyTo, $replyToName));
}
// Add sender to replyTo only if no replyTo received
$autoReplyTo = (empty($this->ReplyTo)) ? true : false;
$this->setSender(array($from, $fromName, $autoReplyTo));
return $this->Send();
}
JMail::setBody (   $content)

Set the email body

Paramètres:
string$contentBody of the email
Renvoie:
JMail Returns this object for chaining.
Depuis:
11.1

Définition à la ligne 185 du fichier mail.php.

Références JMailHelper\cleanText().

{
/*
* Filter the Body
* TODO: Check for XSS
*/
$this->Body = JMailHelper::cleanText($content);
return $this;
}

+ Voici le graphe d'appel pour cette fonction :

JMail::setSender (   $from)

Set the email sender

Paramètres:
mixed$fromemail address and Name of sender array([0] => email Address, [1] => Name) or as a string
Renvoie:
JMail Returns this object for chaining.
Depuis:
11.1
Exceptions:
UnexpectedValueException

Définition à la ligne 129 du fichier mail.php.

Références JLog\add(), JMailHelper\cleanLine(), JText\sprintf(), et JLog\WARNING.

{
if (is_array($from))
{
// If $from is an array we assume it has an address and a name
if (isset($from[2]))
{
// If it is an array with entries, use them
$this->SetFrom(JMailHelper::cleanLine($from[0]), JMailHelper::cleanLine($from[1]), (bool) $from[2]);
}
else
{
}
}
elseif (is_string($from))
{
// If it is a string we assume it is just the address
}
else
{
// If it is neither, we log a message and throw an exception
JLog::add(JText::sprintf('JLIB_MAIL_INVALID_EMAIL_SENDER', $from), JLog::WARNING, 'jerror');
throw new UnexpectedValueException(sprintf('Invalid email Sender: %s, JMail::setSender(%s)', $from));
}
return $this;
}

+ Voici le graphe d'appel pour cette fonction :

JMail::setSubject (   $subject)

Set the email subject

Paramètres:
string$subjectSubject of the email
Renvoie:
JMail Returns this object for chaining.
Depuis:
11.1

Définition à la ligne 169 du fichier mail.php.

Références JMailHelper\cleanLine().

{
$this->Subject = JMailHelper::cleanLine($subject);
return $this;
}

+ Voici le graphe d'appel pour cette fonction :

JMail::useSendmail (   $sendmail = null)

Use sendmail for sending the email

Paramètres:
string$sendmailPath to sendmail [optional]
Renvoie:
boolean True on success
Depuis:
11.1

Définition à la ligne 396 du fichier mail.php.

{
$this->Sendmail = $sendmail;
if (!empty($this->Sendmail))
{
$this->IsSendmail();
return true;
}
else
{
$this->IsMail();
return false;
}
}
JMail::useSMTP (   $auth = null,
  $host = null,
  $user = null,
  $pass = null,
  $secure = null,
  $port = 25 
)

Use SMTP for sending the email

Paramètres:
string$authSMTP Authentication [optional]
string$hostSMTP Host [optional]
string$userSMTP Username [optional]
string$passSMTP Password [optional]
string$secureUse secure methods
integer$portThe SMTP port
Renvoie:
boolean True on success
Depuis:
11.1

Définition à la ligne 428 du fichier mail.php.

{
$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->SMTPAuth === null && $this->Host !== null))
{
$this->IsSMTP();
return true;
}
else
{
$this->IsMail();
return false;
}
}

Documentation des données membres

JMail::$CharSet = 'utf-8'

Réimplémentée à partir de PHPMailer.

Définition à la ligne 33 du fichier mail.php.

JMail::$instances = array()
staticprotected

Définition à la ligne 27 du fichier mail.php.


La documentation de cette classe a été générée à partir du fichier suivant :