<?php
/****************************************************************************************
 * PHP function to send SMTP mail
 ****************************************************************************************
 * email()   - Send email  
 *      arg1   - $from    - email address 
 *      arg2   - $to      - email addresses, multiple addresses separated by commas , 
 *      arg3   - $cc      - email addresses, multiple addresses separated by commas ,  
 *      arg4   - $bcc     - email addresses, multiple addresses separated by commas ,  
 *      arg5   - $replyTo - email addresses, multiple addresses separated by commas ,  
 *      arg6   - $date    - format: Day, dd Mon yyyy hh:mm:ss -h:00  
 *      arg7   - $subject - no newline characters  
 *      arg8   - $message - 
 *      arg9   - $format  - plain or html  
 *      return - $ok      - true or false
 ****************************************************************************************/
    function email($from, $to, $cc, $bcc, $replyTo, $date, $subject, $message, $format)
    {
        $headers  = "From:     "          . $from    . "\n";		// or \r\n for window machines	
    	$headers .= "Cc:       "          . $cc      . "\n";
    	$headers .= "Bcc:      "          . $bcc     . "\n";
    	$headers .= "Reply-To: "          . $replyTo . "\n";
    	$headers .= "Date: "              . $date    . "\n";
     	$headers .= "Content-Type: text/" . $format  . "; charset=utf-8 \n";

        $ok = mail($to, $subject, $message, $headers); 			//mail the data

        return($ok);
    }
?>