+ Reply to Thread
Results 1 to 2 of 2

Thread: How to send mail in UTF8

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    1

    How to send mail in UTF8

    I have a form that I use mail PHP function to send email. This works fine for english but for other languages it does not work. I get unreadable characters. So I assume I need mail function to send the message in UTF8 format. If anyone can help me on this much will be appreciated.

  2. #2
    Hi Enun,

    Yes you need to send the mail in UTF8 format. Here is the function how to do that.
    Code:
    // send the mail in UTF-8 format. Change the Content-type: text/html for html format
    function mail_utf8($to, $subject = 'No subject', $msg = '', $mailheader = '')
    {
    $preheader = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n"; if(!mail($to, '=?UTF-8?B?'. base64_encode($subject) . '?=', $msg, $preheader . $mailheader)) return false; else return true;
    }
    Last edited by David; 12-26-2011 at 12:48 AM.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts