Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [inne][PHP]PHP vs IMAP no i same problemy, Walka z IMAP'em
phpamator
post
Post #1





Grupa: Zarejestrowani
Postów: 328
Pomógł: 3
Dołączył: 10.07.2016
Skąd: UK-raine

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


Hejka,

Daaaawno mnie tu nie było tongue.gif

Ostatnio walczę ze skryptem który, przynajmniej w teorii powinien mi wybierać maile z konta pocztowego po message id
skomponowałem takie coś
  1. echo "<pre>";
  2.  
  3. // Set your timezone
  4. date_default_timezone_set('GMT');
  5.  
  6. // Set your IMAP server details
  7. $hostname = '{imap.gmail.com:993/imap/ssl}';
  8. $username = 'phpamator@mojaskrzynka.com';
  9. $password = 'haseleczkomoje';
  10.  
  11. // Open the specified folder
  12. $mailbox = imap_open($hostname, $username, $password);
  13.  
  14. // Check if the connection was successful
  15. if (!$mailbox) {
  16. die('Cannot connect to the email server: ' . imap_last_error());
  17. }
  18.  
  19. // Specify the Message-ID you want to search for
  20. $messageId = '<65733ef44b55c_1702123456@myserverek.com>';
  21.  
  22. // Search for the email with the given Message-ID
  23. $searchResult = imap_search($mailbox, 'HEADER Message-ID "' . $messageId . '"', SE_UID);
  24.  
  25. // Output search result for debugging
  26. print_r($searchResult);
  27.  
  28. // Fetch the email details using UID
  29. if ($searchResult) {
  30. // Fetch details of the first (and only) matching email
  31. $emailDetails = imap_fetch_overview($mailbox, $searchResult[0], FT_UID);
  32.  
  33. // Output email details
  34. print_r($emailDetails);
  35. } else {
  36. echo "No emails found with the specified Message-ID." . PHP_EOL;
  37. }
  38.  
  39. // Close the IMAP connection
  40. imap_close($mailbox);


wszystko fajnie jak czytam bez ID a jak próbuję wyszukać po id to dostaję "..I.," znaczy nic nie zwraca.
Macie jakieś doświadczenie z IMAPem z php ?

Podpowiedzcie coś

Pozdrówka



Nikt nic questionmark.gifquestionmark.gif?
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: 22.08.2025 - 04:36