Show UTF-8 in the Subject of the mail

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kamlai@gmail.com

    Show UTF-8 in the Subject of the mail

    I've written the following codes to include utf-8 wordings in both the
    subject and the content.

    $headers = "MIME-Version: 1.0\r\n".
    "Content-type: text/plain; charset=utf-8\r\n".
    "From: abc@abc.com";

    mail("target@ab c.com", "<some utf-8 wordings as subject>",
    "<Another utf-8 wordings as content>", $headers);

    In the email received, the content is fine , however, the subject
    becomes 'strange characters'... How to solve this problem? Thanks a lot.

  • Tim Roberts

    #2
    Re: Show UTF-8 in the Subject of the mail

    kamlai@gmail.co m wrote:
    [color=blue]
    >I've written the following codes to include utf-8 wordings in both the
    >subject and the content.
    >
    > $headers = "MIME-Version: 1.0\r\n".
    > "Content-type: text/plain; charset=utf-8\r\n".
    > "From: abc@abc.com";
    >
    > mail("target@ab c.com", "<some utf-8 wordings as subject>",
    >"<Another utf-8 wordings as content>", $headers);
    >
    >In the email received, the content is fine , however, the subject
    >becomes 'strange characters'... How to solve this problem? Thanks a lot.[/color]

    Check out RFC 2047. You can use something like:
    Subject: =?utf-8?b?...base64-encoded-subject...?
    or
    Subject: =?utf-8?q?...quoted-printable-subject...?
    --
    - Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

    Comment

    Working...