mail problem
Posted: Sat Jul 28, 2007 3:14 pm
feyd | Please use
feyd | 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]
Hi
I'm not receiving any email from the code below, can anyone suggest me whats wrong with this?Code: Select all
class mailer
{
function mailer($sendername, $mailfrom, $mailsubject, $mailmessage, $mailto, $mailcc="", $mailbcc="")
//constructor
{
$this->$mailfrom=$sendername . "<$mailfrom>";
$this->$mailsubject=$mailsubject;
$this->$message=$mailmessage;
if(is_array($mailto) && sizeof($mailto))
{
$this->$mailto= join($mailto,",");
}
else
{
$this->mailto=$mailto;
}
if(is_array($mailcc) && sizeof($mailcc))
{
$this->mailcc=join($mailcc,",");
}
else
{
$this->mailbcc=$mailbcc;
}
} //end of emailer constructor
function sendemail()
{
$this->headers="From: ". $this->mailfrom;
if($this->mailcc)
$this->headers.="Cc: ".$this->mailcc;
if($this->mailbcc)
$this->headers.="Bcc: ".$this->mailbcc;
return mail($this->mailto, $this->mailsubject,$this->message, $this->headers);
} //end of send mail function
} //end of class
if($_POST["submitted"]==1) //it works utphere.
{
$objmailer = new mailer("EWS","correct@mailaddress.com","Test mail",$_POST["txtmessage"],$_POST["txtmailto"],"correct@mail2.com","correct@mail3.com");
$objmailer->sendemail();
}
?>feyd | 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]