|
wojtek - 2008-04-09 17:27:56
Hi, I have a question:
I need to connect to gmail and retrive headers, check theirs from adress and leave on server.. And I need to make this more then one time.
Problem is in words: "more then once". When I already retrive and parse messages I leave my script, and when I want to do that again there is no any message to retrive. But all of them are still on server in recived folder.
This is possible to achive this result with POP3 e-mail client class?
PS. I done almost everything as its in demos script with mime parsing.
Manuel Lemos - 2008-04-09 22:25:10 - In reply to message 1 from wojtek
If Gmail does not expose hidden addresses, that is a Gmail configuration issue. You may need to ask in a forum about Gmail if it is possible to make the old messages be accessible via POP3.
wojtek - 2008-04-10 13:18:23 - In reply to message 2 from Manuel Lemos
Ok, thank you...
I understand that this class dosn't remove anything, yeah?
Manuel Lemos - 2008-04-10 22:27:02 - In reply to message 3 from wojtek
It only removes what you explicitly ask to remove.
Usually, Gmail does not expose messages that were received before you activated the POP3 account. If the account does not retrieve any messages, it was not because the class deleted them without you telling it to delete the messages.
wojtek - 2008-04-10 22:54:10 - In reply to message 4 from Manuel Lemos
yes, i know, but I have already activated pop3 at gmail settings... I am going to try with another mailbox... :) Thanks for CLASS and HELP.
Manuel Lemos - 2008-04-10 23:34:48 - In reply to message 5 from wojtek
Yes, but AFAIK, messages sent before the POP3 support was enabled are not made available via POP3.
My Appe - 2008-05-15 04:30:19 - In reply to message 6 from Manuel Lemos
Hi,
(Thanks to Manual foir his excellent pop3 class.)
I think I found the solution to this problem. There is a difference whether you access the message using
$message_file='pop3://'.$connection_name.'/'.$message;
(as the browse_mailbox.php example does), or whether you use
$pop3->RetrieveMessage(1,$headers,$body,2))
as does the test_pop3.php.
In the former, once you downloaded the message, Gmail keeps the message in its folders when you access your account using their webmail client, but hides them when you access your mailbox again using pop. It seems that they want to protect themselves from too much traffic.
In the latter, it leaves the message on the server, as if nothing happened.
Note that you can "reset" your message download history by switching POP in your Gmail settings off and then on again ("Enable POP for all mail (even mail that's already been downloaded)"). After that it gives you again all the messages you already downloaded.
Actually, I have myself two related problems:
1. When accessing Gmail via pop, I also get messages in the sent folder. Does anybody know how to filter them, if the exact "from:" addresses used to send these messages are unknown?
2. Message deletion seems not to work with Gmail. When I mark a message as deleted, it will not be included in any pop3 access anymore. However, it will still show up in the webmail client, it seems not to be deleted from there. So in sum, it seems that "deletion" just means marking for no further download, but not what the word says: deleting the message.
Another question:
Does anybody knows a trick how to get a message into the sent folder of Gmail? Or, related: does anybody know a similar package like this pop3 class from Manuel which works with IMAP?
Thanks
/appe
Manuel Lemos - 2008-05-15 05:36:12 - In reply to message 7 from My Appe
There should be no difference between how you retrieve the message.
Maybe the difference is that when you use that RetrieveMessage call you are only asking for 2 lines of the message body. When you use fopen with that URL, the message is always read to the end.
However you can use the RetrieveMessage function and make it retrieve the whole message. Just pass a negative number instead of 2 to the lines parameter which is the last parameter.
As for the other problems, it is odd that POP3 access causes messages to appear in the sent folder. Are you sure that may not be causes by something else?
About the message deletion problem, I think it is a feature of Gmail. Maybe you need to move to the Trash folder, but I do not see a way to achieve that from POP3. Maybe you can achieve that via IMAP. There are some IMAP classes here:
phpclasses.org/searchtag/imap/by/pa ...
My Appe - 2008-05-15 08:50:00 - In reply to message 8 from Manuel Lemos
Manuel,
you are completely right. The reason for this behavior is the usage of pop3's "RETR" when downloading all the message, and "TOP" when only downloading some lines. After TOP, the message can still be accessed. After "RETR", Gmail marks the message as downloaded, and therefore it is not visible anymore for pop3 requests.
That 'sent' emails are downloaded is actually a "feature" of Gmail. See
mail.google.com/support/bin/answer. ...
I am still wondering if there is a way to notice that the email comes from the 'Sent' folder independent of the email sender address.
Thanks for the imap links, will take a look.
/appe
Manuel Lemos - 2008-05-17 01:25:06 - In reply to message 9 from My Appe
If there is a way, maybe it is some kind of header because POP3 does not support the concept of folder.
|