Actions

API16

JMail/sendMail

From Joomla! Documentation

< API16:JMail
Revision as of 17:54, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Function to send an e-mail

[Edit Descripton]

Description:JMail/sendMail

Syntax

sendMail($from, $fromName, $recipient, $subject, $body, $mode=0, $cc=null, $bcc=null, $attachment=null, $replyTo=null, $replyToName=null)
Parameter Name Default Value Description
$from $from From e-mail address
$fromName $fromName From name
$recipient $recipient Recipient e-mail address(es)
$subject $subject E-mail subject
$body $body Message body
$mode 0 $mode false = plain text, true = HTML
$cc null $cc CC e-mail address(es)
$bcc null $bcc BCC e-mail address(es)
$attachment null $attachment Attachment file name(s)
$replyTo null $replyto Reply to email address(es)
$replyToName null $replytoname Reply to name(s)

Returns

boolean True on success

Defined in

libraries/joomla/mail/mail.php

Importing

jimport( 'joomla.mail.mail' );

Source Body

public function sendMail($from, $fromName, $recipient, $subject, $body, $mode=0,
        $cc=null, $bcc=null, $attachment=null, $replyTo=null, $replyToName=null)
{
        $this->setSender(array($from, $fromName));
        $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);
        $this->addAttachment($attachment);
 
        // 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));
        }
 
        return  $this->Send();
}

[Edit See Also] SeeAlso:JMail/sendMail

Examples

<CodeExamplesForm />