I guess I should have exmplained how it works.
This is a way to have an email, upon arrival, get passed to your php script
instead of proccessed and put into a mailbox. if you wish to save a copy or
have it end up in the correct mailbox, then you need to do that yourself.
This is good for autoreplies, or email request systems (like fax back)
this part[color=blue]
> add line to /etc/mail/virtusertable
>aname@yourdomain.com alias-phpparser
>
>then rebuild the map with
>cd /etc/mail
>makemap hash virtusertable < virtusertable[/color]
adds an email address to the mail server, so anything comming to that email
address would go to user alias-phpparser (since this file only maps email
address to user accounts we map to an alias user)
here we add the alias user, in, well /etc/alias file, this file allows alias
user accounts, these can map to other users, single or more, or can forward
mail to a script. generaly the scripts sit in /etc/smrsh
[color=blue]
>so in /etc/alias file we add the line
>alias-phpparser: "| /etc/smrsh/phpparser.php"[/color]
this tells the box the alias-phpparser is an alias, and to filter the mail
to the script
then in /etc/smrsh/ we put scripts that get passed emails from sendmail,
smrsh is SendMail Retricted SHell, this should be the only dir that sendmail
should be allowed to run scripts.
[color=blue]
>so, in /etc/smrsh/ dir we add the script
>alias-phpparser.php
>also this file needs to be chmod 755[/color]
#!/usr/bin/php -q
<?php
// read from stdin
$fd = fopen("php://stdin", "r");
// we read each line of the incoming email
while (!feof($fd))
{
$inData = fgets($fd, 1024);
$inData = trim($inData);
// we loop over and over untill we read each line
// proccess email here, $inData will contain 1 line from the email
on each pass
}
fclose($fd);
?>
--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Chuck Anderson" <websiteaddress@seemy.sig> wrote in message
news:f584c.10276$i76.158609@attbi_s03...[color=blue]
> CountScubula wrote:
>[color=green]
> >Let me ask this, Are you trying to have PHP parse an email when it[/color][/color]
arrives?[color=blue][color=green]
> >
> >[/color]
> That's what I'd like to do.
>[color=green]
> >If so, differnt aproach than trying to pop a box.
> >
> >[/color]
> I assume you are talking about having new a new email trigger an event
> (parse the email), and that I could still do the same manually or with a
> task scheduler using IMAP functions.
>
> Yes?
>[color=green]
> >Also if you are using, say redhat linux:
> >
> >[/color]
> My site is on a Linux server, but I don't even have shell access. I'll
> keep your suggestion, though, because I *can* get shell access. It
> sounds like what I want to do is no simple thing (at least for me).
>[color=green]
> >in /etc/aliases file add this line:
> >
> >alias-phpparse: "| /etc/smrsh/phpparser.php"
> >
> >
> >then in /etc/smrsh/ create a script called phpparser.php and it should[/color][/color]
look[color=blue][color=green]
> >like this:
> >(make sure the #!/.... is the very first line!)\
> >
> >[/color]
> Gotcha - tells the php "interpreter" to read the following lines.
>[color=green]
> >#!/usr/bin/php -q
> ><?php
> > // read from stdin
> > $fd = fopen("php://stdin", "r");
> >
> > // we read each line of the incoming email
> > while (!feof($fd))
> > {
> > $inData = fgets($fd, 1024);
> > $inData = trim($inData);
> >
> > // we loop over and over untill we read each line
> > // proccess email here, $inData will contain 1 line from the[/color][/color]
email[color=blue][color=green]
> >on each pass
> >
> >
> > }
> > fclose($fd);
> >?>
> >
> >
> >[/color]
> That added line in your next post is quite key to understanding how this
> works, right?
> "aname@yourdomain.com alias-phpparser"
>
> Thanks for the help.
>[color=green]
> >--
> >Mike Bradley
> >
http://www.gzentools.com -- free online php tools
> >"Chuck Anderson" <websiteaddress@seemy.sig> wrote in message
> >news:cnn3c.529026$na.1267192@attbi_s04...[color=darkred]
> >> Can anyone point me in the right direction? I want to use Php to
> >> automate confirmation of someone joining an email list by them replying
> >> to an email (so they don't have to have a browser?).
> >>
> >> I will probably use a hyperlink with a unique ID, but I also want to
> >> know how to go about reading from a mailbox with Php so I can use an
> >> email reply method, too.
> >>
> >> I'm having trouble finding any kind of tutorial. From the bit of
> >> searching I've done, it appears I need to use an IMAP client and the
> >> IMAP functions (I've no experience with using IMAP, but could learn).
> >>
> >> Can I use Php functions to read email from a POP3 mailbox?
> >>
> >> Does anyone know of any tutorials or helpful web sites that might
> >> explain what I need to do?
> >>
> >> Thanks in Advance.
> >>
> >> --
> >> *****************************
> >> Chuck Anderson • Boulder, CO
> >>
http://www.CycleTourist.com
> >> Integrity is obvious.
> >> The lack of it is common.
> >> *****************************[/color]
> >
> >
> >
> >[/color]
>
>
> --
> *****************************
> Chuck Anderson • Boulder, CO
>
http://www.CycleTourist.com
> Integrity is obvious.
> The lack of it is common.
> *****************************[/color]