Re: Capturing Emails
| From: | Jamie Alessio | Date: | Mon, 12 Feb 2001 19:09:10 +0000 |
| Subject: | Re: Capturing Emails | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-39251@lists.php.net to get a copy of this message | ||
> What is the best way to capture an email sent to a server so
> that I can copy it and send it to a number of emails selected from a db.
>
Here's one way to do it:
- You'll need to compile PHP as a cgi executable
(http://php.net/manual/en/install.commandline.php).
- If you are using sendmail you can set up an alias that will direct the email
to a program (you can get this same behavior with other mail delivery agents as
well).
- Have a PHP script that reads from standard input to get the email message
(http://www.php.net/manual/en/function.fopen.php).
- From there you can do whatever you need to with the email.
If you need to parse the email into pieces and/or deal with HTML email,
attachments, etc. then you can check out the source code that runs
http://www.p3mail.com/ He has a number of libraries available
that will help
take care of that.
- Jamie