I have a small pop3 email client and can open read delete etc my email using imap_ functions open, fetch etc.
Now I need an auto redirect that will run from a daemon while I'm away, to:
1) see if a mail is from a client list (I use mySQL address list), and if so,
2) change the TO: address and send it back out.
I can read the raw headers (imap_fetchheader()) and body (imap_body()).
Thought I'd string replace my address with the appropriate substitute TO: address from the db using a simple string replace, and open a stream to write it all out to.
But I do not know how to open the stream.
Something like :
$stream = fsockopen( $server, $port, &$errno, &$errstr );
fwrite($stream, "Raw Headers");
fwrite($stream, "Raw Body");
fclose($stream);
I use this to get to the inbox:
$inbox = @imap_open ("{". $MAIL_HOST . "/pop3:110}", $USER_NAME, $USER_PASS) or header("Location: error.php?error=Inbox Open Error");
Can this be done?
...and if so, what would the server and port for the fsockopen() be?
Or is there a better way?
Thanks in advance.
gsb