Re: Help Reading from a POP3 Mail Server
| From: | Tim Streater | Date: | Fri, 07 Dec 2018 20:21:52 +0000 |
| Subject: | Re: Help Reading from a POP3 Mail Server | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326632@lists.php.net to get a copy of this message | ||
On 07 Dec 2018, at 20:04, John <john.iliffe@iliffe.ca> wrote:
> Tim, FYI, the problem I encountered during testing using a few hundred
> emails randomly grabbed off the server, was that someone had sent an
> e-mail where they delimited a copy/paste operation with a string of dots.
> Since these were all alone on the line they matched the ./n/r sequence
> when I tested for end of e-mail.
>
> The problem with any approach that relies on testing the received data
> is likely to be ambiguities like this. The server, based on looking at
> the received stream, just sends until it gets to EOF, sends the .
> delimiter and stops. fgets() and fread() don't seem to spot this until
> the socket times out.
The server (not sure whether your local one or the remote sender's one) is supposed to do
dot-stuffing to get round this, as I noted. You then have to do dot-unstuffing to restore the
original. See the code I posted.
--
Cheers -- Tim