
I've already tried this solution, but this returns also no matching email: $str = "äpfel" $header = imap_rfc822_parse_headers($headersRaw) Įcho "From: ". $headersRaw = imap_fetchheader($mbox_connection, $mailId, FT_UID) $mailsIds = imap_search($mbox_connection, 'SUBJECT "äpfel"', SE_UID, "UTF-8") Įcho "Found ". $mbox_connection = imap_open($mailbox, $mailbox_username, $mailbox_password) Trying to connect to 'INBOX" Įcho "Trying to connect to '$mailbox'.\n" When I try to search for all emails with the subject "apfel" it works as expected - I can find the email: imap_search($mbox_connection, 'FROM "apfel"', SE_UID, "US-ASCII") I've for example an email with these information: The problem is now, that I can't search for emails with UTF-8 characters.

Now, it returns all expected unseen (unread) emails. (errflg=2) in Unknown on line 0īased on this notice, I've changed the charset from UTF-8 to US-ASCII: imap_search($mbox_connection, 'UNSEEN', SE_UID, "US-ASCII")

Now, I wanted to restrict it to for example only unseen (unread) emails: imap_search($mbox_connection, 'UNSEEN', SE_UID, "UTF-8")īut this unfortunately causes the issue, that no emails can be found anymore - although there are unseen emails - and it also throws this PHP notice: PHP Notice: Unknown: The specified charset is not supported. With UTF-8 and the search criteria ALL I get all emails as expected.

Since the most emails contain non-ASCII characters like äöü, I use UTF-8 in my imap_search() function: imap_search($mbox_connection, 'ALL', SE_UID, "UTF-8") I want to fetch emails from using IMAP and PHP.
