MAiLING LIST HELL
Posted: Wed Aug 30, 2006 3:38 pm
hawleyjr | Please use
class.SimpleMail.php5
hawleyjr | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello Can someone look at my code and tell me why I am getting this message?Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/t/p/ftpcarrie/html/mail/class.SimpleMail.php5:64) in /home/content/f/t/p/ftpcarrie/html/mail/admin_transact.php5 on line 81Code: Select all
<?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;
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 this 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;
}
}
}
?>Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]