| Send mail cu PHP |
|
|
|
| Written by Administrator | |
| Sunday, 24 June 2007 | |
|
<? // Add a multipart boundary above the message $message = "This is a multi-part message in MIME format. \n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; foreach($_FILES as $name=>$v) { if(filesize($_FILES[$name]["tmp_name"])>0) { $file = fopen($_FILES[$name]["tmp_name"],'rb'); $data = fread($file,filesize($_FILES[$name]["tmp_name"])); fclose($file); // Base64 encode the file data $data = chunk_split(base64_encode($data)); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $message.="--{$mime_boundary}\n" . "Content-Type: ".$_FILES["image$i"]["type"].";\n" . "Content-Transfer-Encoding: base64\n". "Content-Disposition: attachment; filename=\"".$_FILES[$name]['name']."\"\n\n" . $data . "\n\n"; } } mail(" This email address is being protected from spam bots, you need Javascript enabled to view it ","Hello",$message,$headers); ?> |
| < Prev |
|---|
| Am lansat www.dreptonline.com , un site numai cu articole din drept,si mult mai bine structurate. |