Jump to content

Help sending html email with phpMailer


hashstar

Recommended Posts

Hi there,

 

i am trying to send a html using phpMailer and am following this tutorial: http://www.askapache.com/php/phpfreaks-eric-rosebrocks-phpmailer-tutorial.html

 

 

I have managed to send an email just fine but when i try to add html to it it doesn't work! I get this message:

 

Mail sent!

Fatal error: Call to undefined method FreakMailer::Body() in /hermes/waloraweb018/b1267/moo.organicgrowshopcouk/testemail.php on line 44

 

 

This is the code I'm using:

 

 

 

<?php

 

// Grab our config settings

require_once($_SERVER['DOCUMENT_ROOT'].'/config.php');

 

// Grab the FreakMailer class

require_once($_SERVER['DOCUMENT_ROOT'].'/include/MailClass.inc');

 

// instantiate the class

$mailer = new FreakMailer();

 

// Set the subject

$mailer->Subject = 'This is a test';

 

// Body

$mailer->Body = 'This is a test of my mail system!';

 

// Add an address to send to.

$mailer->AddAddress('[email protected]', 'Matt Johnson');

 

if(!$mailer->Send())

{

    echo 'There was a problem sending this mail!';

}

else

{

    echo 'Mail sent!';

}

$mailer->ClearAddresses();

$mailer->ClearAttachments();

 

$htmlBody = '<html>

<head>

<title>My HTML Email</title>

</head>

<body>

<br />

<h2>PHP Freaks Rules!</h2>

<p>We invite you to visit <a href="http://www.phpfreaks.com" title="PHP Freaks">PHP Freaks.com</a> for a loving community of PHP Developers who enjoy helping each other learn the language!</p>

 

<p>Sincerely,<br />

PHP Freaks Staff</p>';

 

$mailer->Body($htmlBody);

$mailer->isHTML(true);

 

// Send the E-Mail

?>

 

 

 

 

 

 

How do i define method Body()  ?  Do i need to change something in the phpmailer.class.php file? 

 

Sorry if i sound like a complete n00b.

Link to comment
https://forums.phpfreaks.com/topic/262291-help-sending-html-email-with-phpmailer/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.