Skip to:
Content
Pages
Categories
Search
Top
Bottom

bb_mail for user registration


  • momo-i
    Member

    @momo-i

    Hi all,

    I’m using this in Japanese. When the user is registered, mail is garbled. It seems that it is because the mail body is submitted with raw UTF8 (not MIME-encode) also this is because of mail in Japanese(encoded iso-2022-jp) being provided as shown in RFC1468.(See http://www.ietf.org/rfc/rfc1468.txt)

    However, it is possible to display it even in Japanese with UTF8 normally by doing appropriate treatment.

    1. Add Content-Type header and etc.

    $headers[] = “MIME-Version: 1.0″;

    $headers[] = “Content-Type: text/plain; Charset=UTF-8″;

    $headers[] = “Content-Transfer-Encoding: 8bit”;

    2. MIME encodes the header.

    use mb_encode_mimeheader().

    http://www.php.net/manual/en/function.mb-encode-mimeheader.php

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)

  • _ck_
    Participant

    @_ck_

    hi,

    tried the mb_encode_mimeheader() thing.. but can’t get it to work as desired. :(

    could i please get a bit more of instruction where to put it in with what parameter(s)?

    —-what i have tried


    towards the end of function bb_mail() in bb-includes/pluggable.php

    $headers = trim(join(defined('BB_MAIL_EOL') ? BB_MAIL_EOL : "n", $headers));

    //--added--
    $headers = mb_encode_mimeheader($headers, 'utf-8', 'B', defined('BB_MAIL_EOL') ? BB_MAIL_EOL : "n");
    //--end add--

    return @mail($to, $subject, $message, $headers);

    Although it shows fine as it comes on my Apple Mail, as momo-i and somebody else mentioned, utf8 can get garbled…

    Thank you in advance

    how silly I was…. trying to encode the whole header array….

    here’s the working code, just in case somebody else is too tired to work it out …

    (from around line542 down)

    if ($from)
    //$headers[] = 'From: "' . bb_get_option('name') . '" <' . $from . '>'; //orig
    //
    edit
    $headers[] = 'From: "' . mb_encode_mimeheader(bb_get_option('name'), 'utf-8') . '" <' . $from . '>';
    //
    end edit
    }
    $headers = trim(join(defined('BB_MAIL_EOL') ? BB_MAIL_EOL : "n", $headers));
    //
    edit --added
    $subject = mb_encode_mimeheader($subject, 'utf-8', 'B', defined('BB_MAIL_EOL') ? BB_MAIL_EOL : "n");

    //
    end edit
    return @mail($to, $subject, $message, $headers);

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.