Current time: 11-27-2020, 09:16 PM Hello There, Guest! (LoginRegister)


Post Reply 
Log emails
Author Message
Knut Offline
Member
***

Posts: 736
Joined: Nov 2006
Reputation: 10
Post: #2
RE: Log emails
Hi,

copy this script as /usr/sbin/sendmail-php
Code:
!/usr/bin/perl

# use strict;
use Env;
my $date = `date`;
chomp $date;
open (INFO, ">>/var/log/spam.log") || die "Failed to open file ::$!";
my $uid = $>;
my @info = getpwuid($uid);
if($REMOTE_ADDR) {
print INFO "$date - $REMOTE_ADDR ran $SCRIPT_NAME at $SERVER_NAME \n";
}
else {

print INFO "$date - $PWD - @info";

}
my $mailprog = '/usr/sbin/sendmail';
foreach (@ARGV) {
$arg="$arg" . " $_";
}

open (MAIL,"|$mailprog $arg") || die "cannot open $mailprog: $!n";
while (<STDIN> ) {
print MAIL;
}
close (INFO);
close (MAIL);

then
Code:
chmod +x /usr/sbin/sendmail-php
touch /var/log/spam.log
chmod 777 /var/log/spam.log

change your php.ini for the sites

Code:
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail-php

maybe restart Apache ... done.

(original by J-B (21.11.2006) @ sysop-forum.de)
09-04-2009 04:00 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Log emails - morb - 09-04-2009, 03:16 AM
RE: Log emails - Knut - 09-04-2009 04:00 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)