Re: Using php as a backend bridge between smtp and mysql
| From: | David Robley | Date: | Mon, 04 Mar 2002 22:05:40 +0000 |
| Subject: | Re: Using php as a backend bridge between smtp and mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87167@lists.php.net to get a copy of this message | ||
In article <B8A82373.533D%ken@tossell.net>, ken@tossell.net says...
> Hi,
> I need to have php called from sendmail. I have set up an address to be
> aliased to "|/usr/local/bin/proc-mail" but I get an error saying "service
> unavailable". All permissions correct. See php code below. This is just a
> test mechanism, right now, to send the email to a mysql database for a
> free-webmail system.
>
> #!/usr/local/bin/php -q
> <?php
> $db_name = "mail";
> $table_name = "Messages";
> $connection =
> @mysql_pconnect("mysql.tossell.net","mail","fhsdbfhksdbfhjsd")
> or die("Couldn't connect.");
> $db = @mysql_select_db($db_name, $connection) or die("Couldn't select
> database.");
> $sql = "insert into $table_name (rcpt, send, subject) VALUES
> ('ken','ken@tossell.net','SUP?')";
> mysql_select_db( $db_name, $connection );
> mysql_query($sql);
> ?>
>
> Thanks.
Presumably that script is /usr/local/bin/proc-mail and that is the
complete script? If so, given that it takes no 'external' information,
what happens when you try and run it from the shell? Is it executable by
the appropriate level of user?
--
David Robley
Temporary Kiwi!
Quod subigo farinam