PHP E-Mail Encoding?

后端 未结 7 1524
甜味超标
甜味超标 2020-11-29 08:26

I am having some trouble with foreign characters when sending an e-mail. Could someone advise me on what to do? I suspect the problem could be one of three things.

相关标签:
7条回答
  • 2020-11-29 08:41

    I use the following code:

      $text = "";
      $text .= "<html>\n";
      $text .= "<body style=\"font-family:Arial; \">\n";
    
      $text .= "<b>Add Your text here . . .</b>";
      $text .= date("d.m.Y") . " <br><br>\n\n";
    
      $text .= "</body>\n";
      $text .= "</html>\n";
    
    $headers = 'From: ' . $myEmail . "\r\n";
    $headers .= 'To: ' . $depEmail . "\r\n";    
    $headers .= 'Return-Path: ' . $myEmail . "\r\n";
    $headers .= 'MIME-Version: 1.0' ."\r\n";
    $headers .= 'Content-Type: text/HTML; charset=ISO-8859-1' . "\r\n";
    $headers .= 'Content-Transfer-Encoding: 8bit'. "\n\r\n";
    $headers .= $text . "\r\n";
    
    set_time_limit(30);
    if (!mail('', 'Demande information', '', $headers)) {
      Alert(...)
    
    0 讨论(0)
提交回复
热议问题