This is a discussion on Getting PHP to read an e-mail within the PHP Language forums, part of the PHP Programming Forums category; Ok, for the reference, I'm using PHP 4.3, mySQL and sendmail. I have a news content site, and ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Ok, for the reference, I'm using PHP 4.3, mySQL and sendmail.
I have a news content site, and I have an e-mail address dedicated for PHP content automation. What I'm aiming to do here is have PHP grab the e-mail, parse it, and update the database. Parsing and updating the database is no prob. I'm a little clueless on how to get PHP to grab e-mails. I don't need to be hand-held through it, but if anyone knows reference locations (articles, PHP documentation entries, theory, etc), it would be a big help. Thanks in Advance, Robert |
|
|||
|
Rob wrote:
> Ok, for the reference, I'm using PHP 4.3, mySQL and sendmail. > > I have a news content site, and I have an e-mail address dedicated for PHP > content automation. > > What I'm aiming to do here is have PHP grab the e-mail, parse it, and > update the database. > > Parsing and updating the database is no prob. I'm a little clueless on > how to get PHP to grab e-mails. A .forward file can be used to pass a file to a pipe. Ian P. Christian |
|
|||
|
Carved in mystic runes upon the very living rock, the last words of Rob
of comp.lang.php make plain: > I don't need to be hand-held through it, but if anyone knows reference > locations (articles, PHP documentation entries, theory, etc), it would > be a big help. Well, I can't really give you any references, but I can tell you what I've learned from experience, as I have quite a number of scripts operating this way. First configure your email system to pipe the email to a PHP script. If you don't know how to do that, you'll have to ask someone familiar with your particular system and configuration. The PHP script will need to have a shebang line pointing to the PHP interpreter, for example: #!/usr/bin/php -q as the very first line in the file before the <?php Then just open /dev/stdin: $fh = fopen("/dev/stdin", "r"); and read the email from it. Depending on your system setup, there may be some useful environment and server variables available that can save you some digging and parsing, so I'd suggest dumping those arrays out to a file to see what's there. -- Alan Little Phorm PHP Form Processor http://www.phorm.com/ |
|
|||
|
"Rob" <robertkaranfilian@sbcglobal.net> wrote in message
news:<3Pdjb.52$fF.14346451@newssvr21.news.prodigy. com>... > > I have a news content site, and I have an e-mail address dedicated for PHP > content automation. > > What I'm aiming to do here is have PHP grab the e-mail, parse it, and update > the database. > > Parsing and updating the database is no prob. I'm a little clueless on how > to get PHP to grab e-mails. You have two options: 1. Implement something based on PHP's built-in IMAP functions: http://www.php.net/imap Note that I say IMAP, but these functions are equally capable of working with POP3 and local mailboxes. 2. Go to phpclasses.org and search for a keyword "POP3". There are a couple of classes there that do not rely on PHP's IMAP functions (not all hosting services have them enabled), but implement access to a remote POP3 server directly using the sockets mechanism. Cheers, NC |
|
|||
|
nc@iname.com (Nikolai Chuvakhin) wrote in message news:<32d7a63c.0310151950.467510dc@posting.google. com>...
> "Rob" <robertkaranfilian@sbcglobal.net> wrote in message > news:<3Pdjb.52$fF.14346451@newssvr21.news.prodigy. com>... > > > > I have a news content site, and I have an e-mail address dedicated for PHP > > content automation. > > > > What I'm aiming to do here is have PHP grab the e-mail, parse it, and update > > the database. > > > > Parsing and updating the database is no prob. I'm a little clueless on how > > to get PHP to grab e-mails. > > You have two options: > > 1. Implement something based on PHP's built-in IMAP functions: > > http://www.php.net/imap > > Note that I say IMAP, but these functions are equally capable > of working with POP3 and local mailboxes. > > 2. Go to phpclasses.org and search for a keyword "POP3". There > are a couple of classes there that do not rely on PHP's IMAP > functions (not all hosting services have them enabled), but > implement access to a remote POP3 server directly using the > sockets mechanism. > > Cheers, > NC Third options: check out squirrelmail. http://www.squirrelmail.org/ It works very well for me. -- The source is out there. Browse and document open/share source projects such as Apache, Tcl, PHP, EtherReal, Mozilla, .Net SSCLI at http://www.slink-software.com/ |