Re: limit mail() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As far as I know, there's no way you can do this via PHP.

PHP doesn't "know" about users on the system.  Generally, PHP is run as an
apache module, and thus the scripts are run as the user apache is running
as.

So to start with, you'd probably need to be running a Fast CGI + SuExec
setup or something similar.

I'm not sure how, or if there is a way to do this in postfix.  The mail()
function calls the sendmail binary, so one sort of hackish way might be to
move this binary and write a wrapper script that keeps track of per-user
rate limits, and then invokes the real sendmail binary.  Of course, in this
case, you'd also probably want to make sure the real sendmail binary
couldn't be executed and that users could not write to the file that keeps
track of the rate-limit.

-- Greg

On Tue, Apr 8, 2008 at 12:37 PM, Jordi Moles <jordi@xxxxxxxxx> wrote:

> hello everyone,
>
> first of all... i'm sorry if this has been asked like a million times
> before... but i've been looking for info about this and found nothing so
> far.
>
> anyway....
>
> I've got a server with apache2 and postfix and php5 providing hosting to
> some clients. I've got this big problem about clients sending spam
> massively, either consciously or because they website have been hacked. The
> main way to spam is by using the "mail()" function.
> So far, i've only found how to disable the use of the mail() function
> completely in the php.ini file, but it's not a really good option to me,
> cause i run some server scripts to check for some things and they send some
> mails when they find something wrong.
>
> So... i would like to know what options i have if i want to limit this
> function...
>
> can i disable the function only for some users?
> may be i can set a rate limit for it?
>
> thanks.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux