I have written a script for sending a mail, it gets delivered to the correct email address but in them form of HTML code, I don't know why it's not working as same code is working fine in Joomla 2.5.
Here's my code:
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$subject = 'Account Created';
$from = $config->get('mailfrom');
$fromname = $config->get( 'fromname' );
$body = "<p>Hello Test F,</p><br/><p>Thank you for registering at Deals&offers. Your account is created and activated.</p><br/>You may login to ".JURI::root().'index.php'." using the following username and password:</br><p>Username: ".$fname."</p><p>Password: ".$pwd."/p><br/><p><b>Note:</b> It is recomended to change your password after first login.</p>";
$sender = array(
$from,
$fromname
);
$mailer->setSender($sender);
$mailer->addRecipient($buyerEmail);
$mailer->setSubject($subject);
$mailer->setBody($body);
$send = $mailer->Send();
if ( $send !== true ) {
echo 'Error sending email: ' . $send->message;
} else {
echo 'Mail sent';
}
I have also tried like below, but got same result.
JFactory::getMailer()->sendMail($from,$fromname,$buyerEmail, $subject, $body);
the output I got in the mail is:
<p>Hello Test F,</p><br/><p>Thank you for registering at Deals&offers. Your account is created and activated.</p><br/>You may login to http://server.ashoresystems.com/~dealsand/index.php using the following username and password:</br><p>Username: rowdy</p><p>Password: lX1XZghF/p><br/><p><b>Note:</b> It is recomended to change your password after first login.</p>
I am not sure what I am doing wrong. If anyone has any solution please help.
Try this..
For your first method...You have to set
Reference : http://docs.joomla.org/Sending_email_from_extensions
For your second method...
Sendmail function :
so your code should be