No announcement yet.

Emails encoding is not correct

  • Filter
  • Time
  • Show
Clear All
new posts

  • blackleaf
    commented on 's reply
    Thanks! I got the same issue and now it works!

  • kvn75
    commented on 's reply
    Vielen Dank!

  • AScherff
    i have had this problem also for german chars and found a fix:

    in /core/vb/mail.php

    Funktion: $outtext = preg_replace_callback

    near line 540

    find :

    PHP Code:
    return strtoupper(dechex(ord($matches[1]))); 

    PHP Code:
    return '='.strtoupper(dechex(ord($matches[1]))); 

    Leave a comment:

  • June
    Hello, thank you for posting this thread.

    I had been in the same situation for a long time, and anyhow I could solve the subject problem with many Japanese sites for PHP mail.
    I hope my "mail.php" may help you.
    I am using it in Japanese, so, please change to the appropriate charset names, and so on.

    I have added and changed following parts in my "mail.php" .




    $subject = mb_encode_mimeheader($subject,'ISO-2022-JP');


    $mailfromname = mb_encode_mimeheader($mailfromname,'ISO-2022-JP');
    Attached Files
    Last edited by June; Tue 26 Jan '16, 4:25am.

    Leave a comment:

  • IncWolf
    I just got the same issue and editing that if-statement helped me with that problem:

    PHP Code:
    if ((strtolower(vB_Template_Runtime::fetchStyleVar('charset')) == 'iso-8859-1' OR 
    vB_Template_Runtime::fetchStyleVar('charset') == 'utf-8') AND 

    Leave a comment:

  • san3ani
    one more try to get a response?

    Leave a comment:

  • san3ani
    how come no one commented at least to let me know that my topic has been viewed by the support team?

    Leave a comment:

  • san3ani
    Hello again.
    I tried to diagnose the issue myself. this is what I did
    I went to the file mail.php located in core/vb
    I guessed that the problem is within the function
    public function start($toemail, $subject, $message, $from = '', $uheaders = '', $username = '')

    after doing some tests
    I noticed the problem is that the first if statement
    if ((strtolower(vB_Template_Runtime::fetchStyleVar('charset')) == 'iso-8859-1' OR
                vB_Template_Runtime::fetchStyleVar('charset') == '') AND
                preg_match('/&[a-z0-9#]+;/i', $message))
    is evaluating to true instead of false

    vB_Template_Runtime::fetchStyleVar('charset') returns an empty string ''
    preg_match('/&[a-z0-9#]+;/i', $message)
    returns 1

    I don't know why is that
    1- I don't know how VB suppose to function but just from guessing I think
    vB_Template_Runtime::fetchStyleVar('charset') is suppose to return the value set for the charset in the language setting which is "UTF-8" but it is returning an empty string instead.

    2- preg_match suppose to return 1 if and only if the arguments are matched.
    $message contains Arabic letters in UTF8 encoding so I thought preg_match should have returned 0 to indicate not matching but instead it is returning 1. again I don't know why

    so the problem is that the if statement condition evaluates to true which makes the function double encode the utf8 which result in a messed up encoding

    I figured a workaround for the problem which solved 90% of the problem
    I rearranged the if else if statement so the if now is evaluating the condition that was in the else if and the else if is evaluating the else if condition
    this solved the body of the email encoding and it is now appearing correctly but the subject and the name of the forum is still showing the wrong encoding

    any ideas?

    Leave a comment:

  • san3ani
    started a topic Emails encoding is not correct

    Emails encoding is not correct

    My site is an Arabic forum based on utf8 and everything seems working fine except for the emails that I receive from the forum. For example if a new user registers or a new post is added, the email notification I receive contains non readable characters instead of the Arabic letters. I guess the email function somehow does not use UTF8 when sending an email. Any idea how to fix it.

Related Topics