<? include "class.docket.php"; $obj=new docket(); $appno=$_POST['appno']; $lettertype=$_POST['lettertype']; $recp=$_SESSION['email']; $obj->show_letter($appno,$lettertype); $recp=$_SESSION['email']; $subject=$obj->sub; $a=$obj->letterbody; //$myFile = $_SERVER['DOCUMENT_ROOT']."/docketing_backup/asset/Letter.doc"; $myFile = "asset/Letter.doc"; $fh = fopen($myFile, 'a') or die("can't open file"); echo filesize($myFile); /*fwrite($fh,$a); fclose($fh); function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) { $file = $path.$filename; $file_size = filesize($file); $handle = fopen($file, "r"); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($file); $header = "From: ".$from_name." <".$from_mail.">\r\n"; $header .= "Reply-To: ".$replyto."\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n";