note 54863 deleted from ref.mail by didou

From: Date: Sun, 23 Apr 2006 22:30:34 +0000
Subject: note 54863 deleted from ref.mail by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-109200@lists.php.net to get a copy of this message
Note Submitter: sadikkeskin at hotmail dot com ---- hi all programmer this code is a simple code for attachment mail for use whitout class <?php $type = array('gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'bmp' => 'image/bmp', 'png' => 'image/png', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'swf' => 'application/x-shockwave-flash', 'doc' => 'application/x-msword', 'xls' => 'application/x-msexel', 'bilinmiyor' => '"application/x-unknown-content-type"'); $header=""; $message=""; $boundary='--' . md5( uniqid("myboundary") ); $priorities = array( '1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' ); $priority=$priorities[3]; $charset="iso-8859-9"; $ctencoding="8bit"; $subject="merhaba"; $body="merhaba arkada�lar."; $to="baristasdemir@hotmail.com"; $from="localhost"; $cc=$to; $bcc=$to; $sep= chr(13) . chr(10); $ctype=$type["bilinmiyor"]; $path[]="k9.gif"; //$path[]="kl.mp3"; $disposition="inline"; for($i=0;$i<count($path);$i++){ $message .= "This is a multi-part message in MIME format.\n--$boundary\n"; $message .= "Content-Type: text/plain; charset=$charset\n"; $message .= "Content-Transfer-Encoding: $ctencoding\n\n$body\n"; $basename=basename($path[$i]); $message .= "--$boundary\n"; $message .= "Content-type: $ctype;\n name=\"$basename\"\n"; $message .= "Content-Transfer-Encoding: base64\n"; $message .= "Content-Disposition: $disposition;\n"; $message .= " filename=\"$basename\"\n"; $linesz= filesize( $path[$i])+1; $fp= fopen( $path[$i], 'r' ); $content = chunk_split(base64_encode(fread( $fp, $linesz))); fclose($fp); $message .= $sep.$content; } //_________________________________header_____________________ $header .= "From: $from\n"; $header .= "X-Priority: $priority\n"; $header .= "CC: $cc\n"; $header .= "Mime-Version: 1.0\n"; $header .= "Content-Type: multipart/mixed;\n"; $header .= "boundary=\"$boundary\"\n"; $header .= "Content-Transfer-Encoding: $ctencoding\n"; $header .= "X-Mailer: Php/libMailv1.3\n"; //_________________________________header_____________________ mail($to,$subject,$message."\n",$header); ?>

« previous php.notes (#109200) next »