Loading...
 
Features / Usability

Features / Usability


Missing charset in email header

posts: 12

Hi, how do I set the charset in email header? We are using TikiWiki 2.4 to send broadcast messages in Chinese. We have set the "Default charset for sending mail" to utf-8 in General preferences. But the email header shows missing charset..

Content-Type: text/plain; charset=""
Content-Transfer-Encoding: 7bit

What could possibly go wrong? Which source files should I check?

Attached is the "original" lib/mail/maillib.php file.

Thanks!

posts: 12

// $Id: /cvsroot/tikiwiki/tiki/lib/mail/maillib.php,v 1.2 2007-03-02 19:49:19 luciash Exp $

/* Common shared mail functions */

/*
* function encode_headers()
*
* Encode non-ASCII email headers for mail() function to display
* them properly in email clients.
* Original code by .
* See 'User Contributed Notes' at
* http://php.benscom.com/manual/en/function.mail.php
* Rewritten for Tikiwiki by
*
* For details on Message Header Extensions see
* http://www.faqs.org/rfcs/rfc2047.html
*/

$charset = 'utf-8'; // What charset we do use in Tiki
$in_str = '';

function encode_headers($in_str, $charset) {
$out_str = $in_str;
if ($out_str && $charset) {

// define start delimimter, end delimiter and spacer
$end = "?=";
$start = "=?" . $charset . "?b?";
$spacer = $end . "\r\n" . $start;

// determine length of encoded text within chunks
// and ensure length is even
$length = 71 - strlen($spacer); // no idea why 71 but 75 didn't work
$length = floor($length/2) * 2;

// encode the string and split it into chunks
// with spacers after each chunk
$out_str = base64_encode($out_str);
$out_str = chunk_split($out_str, $length, $spacer);

// remove trailing spacer and
// add start and end delimiters
$spacer = preg_quote($spacer);
$out_str = preg_replace("/" . $spacer . "$/", "", $out_str);
$out_str = $start . $out_str . $end;
}
return $out_str;
}// end function encode_headers


Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting