php mail special characters utf8

后端 未结 2 586
孤独总比滥情好
孤独总比滥情好 2020-11-28 14:59

I have the following script:



        
相关标签:
2条回答
  • 2020-11-28 15:25

    Did you try iconv_set_encoding ?

    This should work :

    <?php
     iconv_set_encoding("internal_encoding", "UTF-8");
    
    $subject = "Testmail — Special Characters";
    $msg = "Hi there,\n\nthis isn’t something easy.\n\nI haven’t thought that it’s that complicated!";
    
    mail(utf8_decode($to), utf8_decode($subject), utf8_decode($msg), utf8_decode($from)."\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n");?>
    
    0 讨论(0)
  • 2020-11-28 15:26

    Use &rsquo; in place of the ’.

    Example:

    The dog&rsquo;s bone.
    

    Make sure you change the content-type from text/plain to text/html.

    0 讨论(0)
提交回复
热议问题