The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how can i install formmail.log to track spam?

Discussion in 'E-mail Discussions' started by meeti, May 14, 2008.

  1. meeti

    meeti Well-Known Member

    Joined:
    Dec 25, 2007
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    16
    Hi,


    it looks likely there are spam or some account sent a lot of mail,

    i want to install a script to track the spam,

    it looks kilely i can install a formmail.log to track it,

    can anyone tell me more detail of the installing?



    thanks
     
  2. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    Try below one:

    mv /usr/sbin/sendmail /usr/sbin/sendmail.act
    (==>NOTE: Watch out .. if you, by mistake, repeat this install you will overwrite your real sendmail file ... better you make yet another copy with "cp" under another name.)
    pico /usr/sbin/sendmail (paste the below code into it)
    chmod +x /usr/sbin/sendmail
    echo > /var/log/formmail.log
    chmod 777 /var/log/formmail.log

    ------------------------------------------------------------------------

    #!/usr/bin/perl

    # use strict;
    use Env;
    my $date = `date`;
    chomp $date;
    open (INFO, ">>/var/log/formmail.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\n";

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

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

    Refer:- http://forum.swsoft.com/showthread.php?threadid=20031
     
Loading...

Share This Page