[CentOS] Bounced email processing
Hugh E Cruickshank
hugh at forsoft.com
Wed Nov 5 18:10:27 UTC 2014
From: John Doe Sent: November 5, 2014 01:51
>
> If you just need something "simple" and know a bit php, you
> could try...
The bit I know is what PHP stands for after that not so much.
> ---
> if ($mbox = imap_open("{imap.domain.com:993/ssl}FOLDER",
> "$email", "$passwd",
> OP_READONLY+OP_DEBUG)) {
> $sorted_mbox = imap_sort($mbox, SORTARRIVAL, 0);
> $status = imap_status($mbox, "{imap.domain.com:993/ssl}FOLDER",
> SA_MESSAGES+SA_UNSEEN);
> $msgs_total = $status->messages;
> if ($msgs_total == 0) { print "No mails...\n"; exit(1); }
> for ($i=0; $i<$msgs_total; $i++) {
> # print imap_fetchheader($mbox, $sorted_mbox[$i]);
> $body = imap_body($mbox, $sorted_mbox[$i]);
> foreach (explode("\n", $body) as $line) {
> ...
> }
> # imap_setflag_full($mbox, $i, "\\Seen");
> }
> #imap_expunge($mbox);
> imap_close($mbox);
> ---
If I understand your example it appears to be retrieving emails from
the mail server. I am still going to have to determine which messages
are bounce messages then decipher the format and attempt to extract the
relevant information from the message. If I have to resort to that then
I might as well write it within our application software. But thanks
for the suggestion.
Regards, Hugh
--
Hugh E Cruickshank, Forward Software, www.forward-software.com
More information about the CentOS
mailing list