douba8048 2015-02-16 05:27
浏览 122
已采纳

发送阿拉伯语文本电子邮件不起作用

I am using this code for user forgot password email . but its not giving me the actual output . after submiting the form it brings arabic result and html tags aswell. I am receving html tags too in my mail code:

//......mail
  $to = $email;
   $subject = 'Forgot Password';
   $message = '
   <html>
   <head>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
   <title>هل نسيت كلمة المرور</title>
   </head>
   <body dir="rtl">



   </p>
  <p align="right">عزيزي،</p>
   <p align="right">لقد تلقينا طلبا من جانبكم لاستعادة كلمة المرور. </p>
   <p align="right">يتم إلحاق بيانات الدخول الخاصة بك أدناه: </p>
   <p align="right">البريد الإلكتروني:  <strong>'.$to.'</strong></p>
   <p align="right"> 
  كلمة المرور:<strong> '.$password.'</strong><br/>
  إلى تسجيل الدخول الرجاء اضغط هنا أو نسخ www.cb.gminns.com/login.php الرابط ولصقه في شريط عنوان المتصفح الخاص بك.

   </p>
   <br>
   <p align="right"> Warm Regards,
Contributors Den Team  </p>
   </body>
   </html>
   ';
   $headers  = 'MIME-Version: 1.0' . "
";
   $headers .= "MIME-Version: 1.0
Content-type: text/plain; charset=UTF-8
"; 
   $headers .= "Content-type: text/html; charset=utf-8" . "
";


   $headers .= 'From: Contributors Den <noreply@test.com>' . "
";
   mail($to, $subject, $message, $headers);

header('location:forgot_password.php?msg=sent');

and the output is giving me like this in my yahoo mail web version ,

<html>
  <head>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
  <title>هل نسيت كلمة المرور</title>
  </head>
  <body dir="rtl">



  </p>
  <p align="right">عزيزي،</p>
  <p align="right">لقد تلقينا طلبا من جانبكم لاستعادة كلمة المرور. </p>
  <p align="right">يتم إلحاق بيانات الدخول الخاصة بك أدناه: </p>
  <p align="right">البريد الإلكتروني:  <strong>admintest@yahoo.com</strong></p>
  <p align="right"> 
  كلمة المرور:<strong> 123</strong><br/>
  إلى تسجيل الدخول الرجاء اضغط هنا أو نسخ  الرابط ولصقه في شريط عنوان المتصفح الخاص بك.

  </p>

  </body>
  </html>

this is the final email I have received and it brings result with html coding

  • 写回答

1条回答 默认 最新

  • duanlian1960 2015-02-16 06:07
    关注

    Here is the issue :

     $headers .= "MIME-Version: 1.0
    Content-type: text/plain; charset=UTF-8
    ";
    

    This should be

     $headers .= "MIME-Version: 1.0
    Content-type: text/html; charset=UTF-8
    ";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等