Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // @see http://api.drupal.org/api/drupal/6
- function drupal_truncate_bytes($string, $len) {
- if (strlen($string) <= $len) {
- return $string;
- }
- if ((ord($string[$len]) < 0x80) || (ord($string[$len]) >= 0xC0)) {
- return substr($string, 0, $len);
- }
- while (--$len >= 0 && ord($string[$len]) >= 0x80 && ord($string[$len]) < 0xC0) {
- }
- return substr($string, 0, $len);
- }
- function mime_header_encode($string) {
- if (preg_match('/[^\x20-\x7E]/', $string)) {
- $chunk_size = 47; // floor((75 - strlen("=?UTF-8?B??=")) * 0.75);
- $len = strlen($string);
- $output = '';
- while ($len > 0) {
- $chunk = drupal_truncate_bytes($string, $chunk_size);
- $output .= ' =?UTF-8?B?' . base64_encode($chunk) . "?=\n";
- $c = strlen($chunk);
- $string = substr($string, $c);
- $len -= $c;
- }
- return trim($output);
- }
- return $string;
- }
- echo "I'm running";
- $message = array(
- 'to' => 'YOUREMAILHERE@example.com',
- 'subject' => 'Hello world',
- );
- mail($message['to'], mime_header_encode($message['subject']), 'Hello world httpd sendmail.');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement