Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] mail() i problem z serwerami hotmail.com i yahoo.com
TwojPan
post
Post #1





Grupa: Zarejestrowani
Postów: 56
Pomógł: 0
Dołączył: 13.08.2013

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


Czesc,

Mam problem z tymi serwerami. NIC nie przychodzi na email tj nawet email nie przychodzi. Kiedy wysylam na np. onet. interie, gmail wsio jest ok a tutaj nawet ustawienie filtrow nie pomaga. Dodalem adres spod ktorego przesylam email (FROM) i tez nic. Wiem ze kod jest poprawny zreszta dla pewnosci wstawilem prosty przyklad f. mail() do innego pliku i wywolalem. Tez nic. Juz nie wiem co mam z tym robic a musze miec to pod hotmail i yahoo. Ktos pomoze questionmark.gif?

Zaznaczam że nie ma listów w spamie czy junk email. Nic, totalne zero.


  1. <?
  2. $o = mail("xxx@hotmail.com","temat","tresc");
  3.  
  4. if($o)
  5. {
  6. print "sent";
  7. }else{
  8. print "false";
  9. }
  10. ?>


Za każdym razem zwraca true a emaila jak nie bylo tak nie ma.


edit:

Znalazlem teraz taki przyklad i tez nic nie dochodzi. Przykld z manuala gdzie pisze ze dziala na hotmail rowniez :/ Na gmail dochodzi.

  1. <?php
  2. $to = "adresat@hotmail.com";
  3. $email = "odpokgo@onet.pl";
  4. $name = $_POST['name'];
  5. $subject = $_POST['subject'];
  6. $comment = $_POST['message'];
  7.  
  8. $To = strip_tags($to);
  9. $TextMessage =strip_tags(nl2br($comment),"<br>");
  10. $HTMLMessage =nl2br($comment);
  11. $FromName =strip_tags($name);
  12. $FromEmail =strip_tags($email);
  13. $Subject =strip_tags($subject);
  14.  
  15. $boundary1 =rand(0,9)."-"
  16. .rand(10000000000,9999999999)."-"
  17. .rand(10000000000,9999999999)."=:"
  18. .rand(10000,99999);
  19. $boundary2 =rand(0,9)."-".rand(10000000000,9999999999)."-"
  20. .rand(10000000000,9999999999)."=:"
  21. .rand(10000,99999);
  22.  
  23.  
  24. for($i=0; $i < count($_FILES['youfile']['name']); $i++){
  25. if(is_uploaded_file($_FILES['fileatt']['tmp_name'][$i]) &&
  26. !empty($_FILES['fileatt']['size'][$i]) &&
  27. !empty($_FILES['fileatt']['name'][$i])){
  28.  
  29. $attach ='yes';
  30. $end ='';
  31.  
  32. $handle =fopen($_FILES['fileatt']['tmp_name'][$i], 'rb');
  33. $f_contents =fread($handle, $_FILES['fileatt']['size'][$i]);
  34. $attachment[]=chunk_split(base64_encode($f_contents));
  35. fclose($handle);
  36.  
  37. $ftype[] =$_FILES['fileatt']['type'][$i];
  38. $fname[] =$_FILES['fileatt']['name'][$i];
  39. }
  40. }
  41.  
  42. /***************************************************************
  43.   Creating Email: Headers, BODY
  44.   1- HTML Email WIthout Attachment!! <<-------- H T M L ---------
  45.   ***************************************************************/
  46. #---->Headers Part
  47. $Headers =<<<AKAM
  48. From: $FromName <$FromEmail>
  49.  Reply-To: $FromEmail
  50.  MIME-Version: 1.0
  51.  Content-Type: multipart/alternative;
  52.   boundary="$boundary1"
  53. AKAM;
  54.  
  55. #---->BODY Part
  56. $Body =<<<AKAM
  57. MIME-Version: 1.0
  58.  Content-Type: multipart/alternative;
  59.   boundary="$boundary1"
  60.  
  61.  This is a multi-part message in MIME format.
  62.  
  63.  --$boundary1
  64.  Content-Type: text/plain;
  65.   charset="windows-1256"
  66.  Content-Transfer-Encoding: quoted-printable
  67.  
  68. $TextMessage
  69.  --$boundary1
  70.  Content-Type: text/html;
  71.   charset="windows-1256"
  72.  Content-Transfer-Encoding: quoted-printable
  73.  
  74. $HTMLMessage
  75.  
  76.  --$boundary1--
  77. AKAM;
  78.  
  79. /***************************************************************
  80.   2- HTML Email WIth Multiple Attachment <<----- Attachment ------
  81.   ***************************************************************/
  82.  
  83. if($attach=='yes') {
  84.  
  85. $attachments='';
  86. $Headers =<<<AKAM
  87. From: $FromName <$FromEmail>
  88.  Reply-To: $FromEmail
  89.  MIME-Version: 1.0
  90.  Content-Type: multipart/mixed;
  91.   boundary="$boundary1"
  92. AKAM;
  93.  
  94. for($j=0;$j<count($ftype); $j++){
  95. $attachments.=<<<ATTA
  96. --$boundary1
  97.  Content-Type: $ftype[$j];
  98.   name="$fname[$i]"
  99.  Content-Transfer-Encoding: base64
  100.  Content-Disposition: attachment;
  101.   filename="$fname[$j]"
  102.  
  103. $attachment[$j]
  104.  
  105. ATTA;
  106. }
  107.  
  108. $Body =<<<AKAM
  109. This is a multi-part message in MIME format.
  110.  
  111.  --$boundary1
  112.  Content-Type: multipart/alternative;
  113.   boundary="$boundary2"
  114.  
  115.  --$boundary2
  116.  Content-Type: text/plain;
  117.   charset="windows-1256"
  118.  Content-Transfer-Encoding: quoted-printable
  119.  
  120. $TextMessage
  121.  --$boundary2
  122.  Content-Type: text/html;
  123.   charset="windows-1256"
  124.  Content-Transfer-Encoding: quoted-printable
  125.  
  126. $HTMLMessage
  127.  
  128.  --$boundary2--
  129.  
  130. $attachments
  131.  --$boundary1--
  132. AKAM;
  133. }
  134.  
  135. /***************************************************************
  136.   Sending Email
  137.   ***************************************************************/
  138. $ok=mail($To, $Subject, $Body, $Headers);
  139. echo $ok?"<h1> Mail Sent</h1>":"<h1> Mail not SEND</h1>";
  140. ?>


Ten post edytował TwojPan 14.04.2014, 07:45:30
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 20.08.2025 - 06:25