Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

how can i install formmail.log to track spam?

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

  1. meeti

    meeti Well-Known Member

    Joined:
    Dec 25, 2007
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    66
    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:
    68
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice