Location: PHPKode > scripts > Email Sender class > email-sender-class/email.php
<?
class cls_email_module
{
   function mailSend($tomail,$frommail,$subj,$message,$html="")
  	{
  
  
               if($html)
                {
                 $headers  = "MIME-Version: 1.0\r\n";
	  	       $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	  	       $headers .="From:$frommail";
                }
               else
               {
                $headers .="From:$frommail";
               }
  
  
  		$sSubject = $subj;
  		$sBody = $message;
  
  		//	Parsing body
  
  		$body = $sBody;
  
  	for($ptr = 0; $ptr < strlen($body); $ptr++)
  			{
  			        switch($body[ $ptr ])
  				{
  				 	case "{":
  						$is_token = 1;
  						$token = "";
  						break;
  					case "}";
  						$is_token = 0;
  						eval("global \$".strtolower($token).";");
  						eval("\$sVal = \$".strtolower($token).";");
  						$sBody = str_replace("{{$token}}", "$sVal", $sBody);
  
  						$token = "";
  						break;
  				}
  
  			 	if(($body[ $ptr ] != "{" && $body[ $ptr ] != "}") && $is_token)
  				{
  				 	$token .= $body[ $ptr ];
  
  			}
  		}
  	$re=mail($tomail, $sSubject,$sBody,$headers);
     $toShow="<table cellpadding=2 cellspacing=0 border=0 bordercolor=#ffffff>";
     $toShow.="<tr>";
     $toShow.="<td bgcolor=#84C7FF><font face=arial size=2><b>Subject</b></font></td>";
     $toShow.="<td bgcolor=#84C7FF><font face=arial size=2>$subj</font></td>";
     $toShow.="</tr>";
     $toShow.="<tr>";
     $toShow.="<td bgcolor=#84C7FF><font face=arial size=2><b>Message</b></font></td>";
     $toShow.="<td bgcolor=#84C7FF valign=top><font face=arial size=2>$sBody</font></td>";
     $toShow.="</tr>";
     $toShow.="</table>";     
  	return $toShow;
	}
}
Return current item: Email Sender class