// Add file attachment to the message
$message .= "Content-Type: ".$fileatt_type."\r\n" .
" name=\"".$fileatt_name."\"\r\n" .
"Content-Transfer-Encoding: base64\r\n" .
"Content-Disposition: attachment;\r\n" .
" filename=\"".$fileatt_name."\"\r\n\r\n" .
$data."\r\n" .
"--".$mime_boundary."\r\n";