Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imap_search() Yahoo #75

Closed
shdinx opened this issue Apr 15, 2015 · 4 comments
Closed

imap_search() Yahoo #75

shdinx opened this issue Apr 15, 2015 · 4 comments
Labels
enhancement This will enhance this library.

Comments

@shdinx
Copy link

shdinx commented Apr 15, 2015

Hi,

Thank you for this imap class. So far it has been very useful.
However, I have found an issue while parsing mails from Yahoo which took me a while to understand.

The imap_search() charset you are using by default is "utf-8" but for some reason the yahoo imap stream expect the charset to be uppercase "UTF-8". When using imap_seach() on a yahoo stream with lowercase utf-8 the result is false while with uppercase we get the expected IDs back.

Here is a quick sample:

$sevrer = "{imap.mail.yahoo.com:993/imap/ssl}INBOX";
$username = "";
$password = "";

// open connection
$imapStream = imap_open($sevrer, $username, $password);

// check connection
if (! $imapStream) {
throw new Exception('Connection error: ' . imap_last_error());
}

$criteria = "SINCE 01-Jan-2015";
var_dump(imap_search($imapStream, $criteria, SE_UID, 'utf-8')); // false
var_dump(imap_search($imapStream, $criteria, SE_UID, 'UTF-8')); // array of message numbers or UIDs

// close connection
if ($imapStream && is_resource($imapStream)) {
imap_close($imapStream, CL_EXPUNGE);
}

Cheers

@barbushin
Copy link
Owner

Hey. Thanks for that notice!

So may be we should always uppercase charset name? The question is if UTF-8 will works with other mail servers, like utf-8. Could you please check this?

@barbushin barbushin added the enhancement This will enhance this library. label Apr 15, 2015
@shdinx
Copy link
Author

shdinx commented Apr 15, 2015

Tested it for:
hotmail, yahoo and gmail

I can not find a RFC document describing the use of charset for imap.
However, in every RFC document describing the imap protocol and the charset, I can see that they use the uppercase version.

For example: https://tools.ietf.org/html/rfc5738

Hope this helps.

@barbushin
Copy link
Owner

This helps a lot. Thank you, @shdinx!

@akhzarjaved
Copy link

Any solution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This will enhance this library.
Projects
None yet
Development

No branches or pull requests

3 participants