Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z kodowanie utf-8
rebrov
post
Post #1





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 19.09.2007

Ostrzeżenie: (0%)
-----


Mam problem z pewną funkcją (ponizej)

Mianowicie chodzi mi o wysyłanie maila, gdy go wyśle zamiast polskich liter (ąęł etc.) wyskakują same krzaki.
Próbowałem dorzucić w pewnych miejscach linijke:

  1. /nMIME-Version: 1.0nContent-type: text/html; charset=UTF-8
 

ale to nie zadziałało.. Prosiłbym o pomoc

  1.  
  2. function processadcontact($adid,$sendersname,$checkhuman,$numval1,$numval2,$sendersemail,$contactmessage,$ermsg)
  3. {
  4.  
  5. global $nameofsite,$siteurl,$thisadminemail;
  6. $error=false;
  7. $adidmsg='';
  8. $sendersnamemsg='';
  9. $checkhumanmsg='';
  10. $sendersemailmsg='';
  11. $contactmessagemsg='';
  12. $sumwrongmsg='';
  13. $sendersemailwrongmsg='';
  14.  
  15. $thesum=($numval1 + $numval2);
  16.  
  17. if(!isset($adid) || empty($adid))
  18. {
  19. $error=true;
  20. $adidmsg="<li>";
  21. $adidmsg.=__("The ad could not be identified due to a missing ad identification number","AWPCP");
  22. $adidmsg.="</li>";
  23. }
  24. if(!isset($sendersname) || empty($sendersname))
  25. {
  26. $error=true;
  27. $sendersnamemsg="<li>";
  28. $sendersnamemsg.=__("You did not enter your name. You must include a name for this message to be relayed on your behalf","AWPCP");
  29. $sendersnamemsg.="</li>";
  30. }
  31.  
  32. if(get_awpcp_option('contactformcheckhuman') == 1)
  33. {
  34.  
  35. if(!isset($checkhuman) || empty($checkhuman))
  36. {
  37. $error=true;
  38. $checkhumanmsg="<li>";
  39. $checkhumanmsg.=__("You did not solve the Math Problem","AWPCP");
  40. $checkhumanmsg.="</li>";
  41. }
  42. if($checkhuman != $thesum)
  43. {
  44. $error=true;
  45. $sumwrongmsg="<li>";
  46. $sumwrongmsg.=__("Your solution to the Math problem was incorrect","AWPCP");
  47. $sumwrongmsg.="</li>";
  48. }
  49. }
  50.  
  51. if(!isset($contactmessage) || empty($contactmessage))
  52. {
  53. $error=true;
  54. $contactmessagemsg="<li>";
  55. $contactmessagemsg.=__("There was no text entered for your message","AWPCP");
  56. $contactmessagemsg.="</li>";
  57. }
  58.  
  59. if(!isset($sendersemail) || empty($sendersemail))
  60. {
  61. $error=true;
  62. $sendersemailmsg="<li>";
  63. $sendersemailmsg.=__("You did not enter your name. You must include a name for this message to be relayed on your behalf","AWPCP");
  64. $sendersemailmsg.="</li>";
  65. }
  66. if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $sendersemail))
  67. {
  68. $error=true;
  69. $sendersemailwrongmsg="<li>";
  70. $sendersemailwrongmsg.=__("The email address you entered was not a valid email address. Please check for errors and try again","AWPCP");
  71. $sendersemailwrongmsg.="</li>";
  72. }
  73.  
  74. if($error)
  75. {
  76. $ermsg="<p>";
  77. $ermsg.=__("There has been an error found. Your message has not been sent. Please review the list of problems, correct them then try to send your message again","AWPCP");
  78. $ermsg.="</p>";
  79. $ermsg.="<b>";
  80. $ermsg.=__("The errors","AWPCP");
  81. $ermsg.=":</b><br/>";
  82. $ermsg.="<ul>$adidmsg $sendersnamemsg $checkhumanmsg $contactmessagemsg $sumwrongmsg $sendersemailmsg $sendersemailwrongmsg</ul>";
  83.  
  84. load_ad_contact_form($adid,$sendersname,$checkhuman,$numval1,$numval2,$sendersemail,$contactmessage,$ermsg);
  85. }
  86. else
  87. {
  88. $sendersname=strip_html_tags($sendersname);
  89. $contactmessage=strip_html_tags($contactmessage);
  90. $theadtitle=get_adtitle($adid);
  91. $sendtoemail=get_adposteremail($adid);
  92. $contactformsubjectline=get_awpcp_option('contactformsubjectline');
  93.  
  94. if(isset($contactformsubjectline) && !empty($contactformsubjectline) )
  95. {
  96. $subject="$contactformsubjectline";
  97. }
  98. else
  99. {
  100. $subject=__("Regarding","AWPCP");
  101. $subject.=": $theadtitle";
  102. }
  103. $awpcpbreak1="<br/>";
  104. $awpcpbreak2="<br/><br/>";
  105. $contactformbodymessage=get_awpcp_option('contactformbodymessage');
  106. $contactformbodymessage.="$awpcpbreak2";
  107. $contactformbodymessage.=__("Message","AWPCP");
  108. $contactformbodymessage.="$awpcpbreak2";
  109. $contactformbodymessage.=$contactmessage;
  110. $contactformbodymessage.="$awpcpbreak2";
  111. $contactformbodymessage.=__("Reply To","AWPCP");
  112. $contactformbodymessage.=$sendersemail;
  113. $contactformbodymessage.="$awpcpbreak2";
  114. $contactformbodymessage.="$nameofsite";
  115. $contactformbodymessage.="$awpcpbreak1";
  116. $contactformbodymessage.=$siteurl;
  117. $contactformbodymessage.="$awpcpbreak1";
  118.  
  119.  
  120. $from_header = "From: ". $nameofsite . " <" . $thisadminemail . ">\r\n";
  121.  
  122.  
  123. if(send_email($thisadminemail,$sendtoemail,$subject,$contactformbodymessage,true))
  124. {
  125. $contactemailmailsent=1;
  126. }
  127. else
  128. {
  129.  
  130. $contactformbodymessage=str_replace("$awpcpbreak1", "\n", $contactformbodymessage);
  131. $contactformbodymessage=str_replace("$awpcpbreak2", "\n\n", $contactformbodymessage);
  132.  
  133. if((mail($sendtoemail, $subject, $contactformbodymessage, $from_header)))
  134. {
  135. $contactemailmailsent=1;
  136. }
  137. else
  138. {
  139. $awpcp_smtp_host = get_awpcp_option('smtphost');
  140. $awpcp_smtp_username = get_awpcp_option('smtpusername');
  141. $awpcp_smtp_password = get_awpcp_option('smtppassword');
  142.  
  143. $contactformbodymessage=str_replace("$awpcpbreak1", "\n", $contactformbodymessage);
  144. $contactformbodymessage=str_replace("$awpcpbreak2", "\n\n", $contactformbodymessage);
  145.  
  146. $headers = array ('From' => $from_header,
  147. 'To' => $sendtoemail,
  148. 'Subject' => $subject);
  149. $smtp = Mail::factory('smtp',
  150. array ('host' => $awpcp_smtp_host,
  151. 'auth' => true,
  152. 'username' => $awpcp_smtp_username,
  153. 'password' => $awpcp_smtp_password));
  154.  
  155. $mail = $smtp->send($sendtoemail, $headers, $contactformbodymessagx);
  156.  
  157. if (PEAR::isError($mail))
  158. {
  159. $contactemailmailsent=0;
  160. }
  161. else
  162. {
  163. $contactemailmailsent=1;
  164. }
  165. }
  166. }
  167.  
  168. if($contactemailmailsent)
  169. {
  170. $contactformprocessresponse=__("Your message has been sent","AWPCP");
  171. }
  172. else
  173. {
  174. $contactformprocessresponse=__("There was a problem encountered during the attempt to send your message. Please try again and if the problem persists, please contact the system administrator","AWPCP");
  175. }
  176. }
  177.  
  178. $contactpostform_content=$contactformprocessresponse;
  179. echo "<div id=\"classiwrapper\">";
  180. awpcp_menu_items();
  181. echo $contactformprocessresponse;
  182. echo "</div>";
  183.  
  184. }
  185.  
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 19:06