Re: Access to a POP3 mailbox
- From: "C." <colin.mckinnon@xxxxxxxxx>
- Date: 22 Mar 2007 07:21:27 -0700
On 22 Mar, 11:18, bill <nob...@xxxxxxxxxxx> wrote:
I am in preliminary design of a contact management program. The<snip>
user would like to use his current mail server (POP3 - remote).
Using the IMAP functions can I write a PHP script to:
scan the subject lines of all mail in the mailbox ?
pop just certain messages from the inbox ?
delete those messages from the inbox ?
Yes. Something like...
$in=imap_open(...);
$msgs=imap_headers($in); // gets the headers from the currently
available msgs
foreach ($msgs as $index=>$header) {
if (strstr($header, $look_for)) { // may want to explicitly extract
the subject
$email=imap_fetchstructure($in, $index);
if ($email && save($email)) {
imap_delete($in, $index);
}
}
}
imap_expunge($in);
imap_close($in);
all without disturbing the other messages in his inbox that are
downloaded to his usual email client (Thunderbird).
....but you need to make sure that he doesn't delete your meassages
from the mailbox when he downloads the other stuff.
If anyone can suggest a better way to do this, I am all ears.
It'd be a lot better to handle the messages synchronously, e.g. with a
custom procmail script launching the PHP script. But that rather
depends on having POSIX or similar on the MTA or MUA box.
C.
.
- Follow-Ups:
- Re: Access to a POP3 mailbox
- From: bill
- Re: Access to a POP3 mailbox
- References:
- Access to a POP3 mailbox
- From: bill
- Access to a POP3 mailbox
- Prev by Date: fpdf image problem
- Next by Date: Re: How to grayscale a gif using bit-swapping
- Previous by thread: Access to a POP3 mailbox
- Next by thread: Re: Access to a POP3 mailbox
- Index(es):
Relevant Pages
|