note 69129 modified in function.mail by danbrown

From: Date: Sat, 25 Apr 2009 15:01:11 +0000
Subject: note 69129 modified in function.mail by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153740@lists.php.net to get a copy of this message
Change the function addattachment for multipartmail to auto detect the mime_content_type ... <?php function addattachment($file){ $fname = substr(strrchr($file, "/"), 1); $data = file_get_contents($file); $i = count($this->parts); $content_id = "part$i." . sprintf("%09d", crc32($fname)) . strrchr($this->to_address, "@"); $this->parts[$i] = "Content-Type: ".mime_content_type($file)."; name=\"$fname\"\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-ID: <$content_id>\r\n" . "Content-Disposition: inline;\n" . " filename=\"$fname\"\r\n" . "\n" . chunk_split( base64_encode($data), 68, "\n"); return $content_id; } ?> --was-- Change the function addattachment for multipartmail to auto detect the mime_content_type ... function addattachment($file){ $fname = substr(strrchr($file, "/"), 1); $data = file_get_contents($file); $i = count($this->parts); $content_id = "part$i." . sprintf("%09d", crc32($fname)) . strrchr($this->to_address, "@"); $this->parts[$i] = "Content-Type: ".mime_content_type($file)."; name=\"$fname\"\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-ID: <$content_id>\r\n" . "Content-Disposition: inline;\n" . " filename=\"$fname\"\r\n" . "\n" . chunk_split( base64_encode($data), 68, "\n"); return $content_id; } http://php.net/manual/en/function.mail.php

« previous php.notes (#153740) next »