I'm trying to send foreign language emails, and while the body of the email isn't being a problem the subject line is. It doesn't show properly in Outlook Express.. I just get a line of boxes or question marks. Does anyone know of a working object/function.. preferably that you've used and know works coz I've tried a few now and had no joy. Oh, and nothing from PEAR either coz it needs to stand alone.

    you need to make your text use correct format:
    http://php.net/mail

    there are a several different mail format standards that are used
    one common is 'base64' something
    php has functions for this - to format mail body text for different standards

      Originally posted by halojoy
      you need to make your text use correct format:
      http://php.net/mail

      there are a several different mail format standards that are used
      one common is 'base64' something
      php has functions for this - to format mail body text for different standards

      Reading the manual was the first thing I did. But thanks anyway.

        Reading the manual was the first thing I did. But thanks anyway.

        But HOW do you read manual?

        This is a quote from the manual you say you have read:

        If your server doesn't have mb_send_mail() enabled but you want to use non-ascii (multi-byte) chars in an email's subject or name headers, you can use something like the following:

        <?php 
        $charset = "iso-2202-jp"; // japanese 
        $to = encode("japanese name 01", $charset) . " <to@email.com>"; 
        $from = encode("japanese name 02", $charset) . " <from@email.com>"; 
        $subject = encode("japanese text"); 
        $message = "does not need to be encoded"; 
        mail($to, $subject, $message, $from); 
        
        function encode($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 = 75 - strlen($start) - strlen($end); 
           $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; 
        } 
        // for details on Message Header Extensions 
        // for Non-ASCII Text see ... 
        // [url]http://www.faqs.org/rfcs/rfc2047.html[/url] 
        
        ?>

          Originally posted by halojoy
          But HOW do you read manual?

          This is a quote from the manual you say you have read:

          I've tried that. It doesn't work for UTF-8 encoded characters.

            Write a Reply...