Call mail function in joomla 3.0

In Joomla 3.0, you can use the JMail class to send emails. Here's an example of how to use it:

$mail = JFactory::getMailer();
$mail->setSender(array('[email protected]', 'Your Name'));
$mail->addRecipient('[email protected]');
$mail->setSubject('Test Email');
$mail->setBody('This is a test email');

if (!$mail->send()) {
    echo $mail->getError();
} else {
    echo 'Email sent successfully';
}

In this example, we're creating a new JMail object using the JFactory::getMailer() method. We then set the sender's email address and name using the setSender() method. We add a recipient using the addRecipient() method, set the subject using the setSubject() method, and set the email body using the setBody() method.

Finally, we check if the email was sent successfully using the send() method. If the email was not sent, we can get the error message using the getError() method.

You can also use the JMail class to send HTML emails by setting the isHTML property to true:

$mail = JFactory::getMailer();
$mail->setSender(array('[email protected]', 'Your Name'));
$mail->addRecipient('[email protected]');
$mail->setSubject('Test Email');
$mail->setBody('This is a test email');
$mail->isHTML(true);

if (!$mail->send()) {
    echo $mail->getError();
} else {
    echo 'Email sent successfully';
}

In this example, we're setting the isHTML property to true to indicate that the email body is in HTML format.