Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 2nd, 2009, 07:38 PM
Registered User
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Class SimpleMail ( need help)

I copied the class.SimpleMail.php and mail_quick.php code from the Beginning
php5, apache,mysql web development book. It is not working on my yahoo site.

Here is the code. Please let me know why it is not working.

// this is class.SimpleMail.php
<?php
class SimpleMail {
public $to = NULL;
public $cc = NULL;
public $bcc = NULL;
public $from = NULL;
public $subject = '';
public $body = '';
public $htmlbody = '';
public $send_text = TRUE;
public $send_html = FALSE;
private $message = '';
private $headers = '';

public function send($to = NULL,
$subject = NULL,
$message = NULL,
$headers = NULL) {
if (func_num_args() >= 3) {
$this->to = $to;
$this->subject = $subject;
$this->message = $message;
echo $this->to
if ($headers) {
$this->headers = $headers;
}

} else {

if ($this->from) {
$this->headers .= "From: " . $this->from . "\r\n";
}
if ($this->cc) {
$this->headers .= "Cc: " . $this->cc . "\r\n";
}
if ($this->bcc) {
$this->headers .= "Bcc: " . $this->bcc . "\r\n";
}
if ($this->send_text and !$this->send_html) {
$this->message = $this->body;
} elseif ($this->send_html and !$this->send_text) {
$this->message = $this->htmlbody;
$this->headers .= "MIME-Version: 1.0\r\n";
$this->headers .= "Content-type: text/html; " .
"charset=iso-8859-1\r\n";
} else {
$_boundary = "==MP_Bound_xyccr948x==";
$this->headers .= "MIME-Version: 1.0\r\n";
$this->headers .= "Content-type: multipart/alternative; " .
"boundary=\"$_boundary\"\r\n";

$this->message = "This is a Multipart Message in " .
"MIME format\n";
$this->message .= "--$_boundary\n";
$this->message .= "Content-Type: text/plain; " .
"charset=\"iso-8859-1\"\n";
$this->message .= "Content-Transfer-Encoding: 7bit\n\n";
$this->message .= $this->body . "\n";
$this->message .= "--$_boundary\n";
$this->message .= "Content-type: text/html; " .
"charset=\"iso-8859-1\"\n";
$this->message .= "Content-Transfer-Encoding: 7bit\n\n";
$this->message .= $this->htmlbody . "\n";
$this->message .= "--$_boundary--";
}
}
if (!mail($this->to,$this->subject,$this->message,$this->headers)) {
throw new Exception('Sending mail failed.');
return FALSE;
} else {
return TRUE;

}
}
}
?>

// this is mail_quick.php.

<?php
require 'class.SimpleMail.php';
$postcard = new SimpleMail();
if ($postcard->send("tadessekinfu@yahoo.com",
"Quick message test",
"This is a test using SimpleMail::send!")) {
echo "Quick message sent successfully!";
}

?>
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Class SimpleMail timType3 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 July 27th, 2008 05:56 PM
class SimpleMail timType3 Beginning PHP 1 September 5th, 2006 07:04 AM
SimpleMail class problems derrida BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 July 6th, 2006 05:52 AM
class.SimpleMail.php problem mrthis PHP Databases 2 December 28th, 2005 09:30 AM
How to include c# class and vb class in the .vbprj umeshayk VS.NET 2002/2003 2 January 9th, 2004 12:08 AM



All times are GMT -4. The time now is 01:52 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.