note 72836 deleted from ref.mail by danbrown

From: Date: Sun, 17 May 2009 20:10:51 +0000
Subject: note 72836 deleted from ref.mail by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155346@lists.php.net to get a copy of this message
Note Submitter: Max Howell ---- I find this a useful function, and it's a lot easier to read and edit than the proceeding set. Many thanks to the proceeding set though, since they taught me how to do it! <?php function mxcl_mail( $subject, $message ) { ob_start(); print_r( $GLOBALS ); $teh_globals = chunk_split( base64_encode( ob_get_clean() ) ); // base 64 encode $date = date( 'r' ); $phpversion = phpversion(); $boundary = md5( time() ); $filename = '$GLOBALS.txt'; $headers = <<<END From: $_SERVER[PHP_SELF] <php@$_SERVER[SERVER_NAME]> Date: $date X-Mailer: PHP v$phpversion MIME-Version: 1.0 Content-Type: multipart/related; boundary="$boundary" END; $message = <<<END --$boundary Content-Type: text/plain; charset="iso-9959-1" Content-Transfer-Encoding: 7bit $message --$boundary Content-Type: octet-stream; name="$filename" Content-Disposition: attachment; filename="$filename" Content-Transfer-Encoding: base64 $teh_globals --$boundary-- END; mail( 'webmaster@example.com', $subject, $message, $headers ); } ?>

« previous php.notes (#155346) next »