2 ################################################################################
4 # File: $RCSfile: checkaddress.cgi,v $
5 # Revision: $Revision: 1.1 $
6 # Description: Check an email address
7 # Author: Andrew@DeFaria.com
8 # Created: Mon Jan 16 20:25:32 PST 2006
9 # Modified: $Date: 2013/06/12 14:05:47 $
12 # (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
14 ################################################################################
19 local $0 = $FindBin::Script;
21 use lib "$FindBin::Bin/../lib";
22 use lib "$FindBin::Bin/../../lib";
26 use CGI qw(:standard);
28 # Get MAPSUser from cookie
32 $userid = param 'user';
34 $userid = cookie 'MAPSUser';
37 $userid //= $ENV{USER};
39 my $sender = param 'sender';
42 my ($list, $email_on_file, $rec) = @_;
44 my $next = $rec->{sequence} - 1;
45 my $rule = "Rule: $email_on_file (";
47 -href => "/maps/php/list.php?type=$list&next=$next",
49 }, "$list:$rec->{sequence}";
52 if ($rec->{retention}) {
53 $rule .= "Retention: " . $rec->{retention} . br;
56 if ($rec->{comment}) {
57 $rule .= "Comment: " . $rec->{comment};
65 header (-title => "MAPS: Check Address"),
66 start_html (-title => "MAPS: Check Address",
67 -author => "Andrew\@DeFaria.com");
68 print h3 {-align => "center",
70 "MAPS: Checking address $sender";
78 # Algorithm change: We now first check to see if the sender is not found
79 # in the message and skip it if so. Then we handle if we are the sender
80 # and that the from address is formatted properly. Spammers often use
81 # the senders email address (i.e. andrew@defaria.com) as their from address
82 # so we check "Andrew DeFaria <Andrew@DeFaria.com>", which they have never
83 # forged. This catches a lot of spam actually.
85 # Next we check to see if the sender is on our whitelist. If so then we let
86 # them in. This allows us to say whitelist josephrosenberg@hotmail.com while
87 # still nulllisting all of the other hotmail.com spammers.
89 # Next we process blacklisted people as they are also of high priority.
91 # Then we process nulllist people.
93 # Finally, we handle return processing
95 # Some email addresses have a '+' in them (e.g.
96 # wipro+autoreply@talent.icims.com). The problem is that CGI.pm replaces the
97 # '+' with a space. Now email addresses cannot contain spaces so we're gonna
98 # assume that a space in the email should be a '+'.
101 ($onlist, $rec) = OnWhitelist($sender, $userid, 0);
104 print div {-align => "center"},
105 font {-color => "green"},
106 "Messages from", b ($sender), "will be", b ("delivered"), br, hr;
107 print formatRule('white', $sender, $rec);
109 ($onlist, $rec) = OnBlacklist($sender, 0);
112 print div {-align => "center"},
113 font {-color => "black"},
114 "Messages from", b ($sender), "will be", b ("blacklisted"), br, hr;
115 print formatRule('black', $sender, $rec);
117 ($onlist, $rec) = OnNulllist($sender, 0);
120 print div {-align => "center"},
121 font {-color => "grey"},
122 "Messages from", b ($sender), "will be", b ("discarded"), br, hr;
123 print formatRule('null', $sender, $rec);
125 print div {-align => "center"},
126 font {-color => "red"},
127 "Messages from", b ($sender), "will be", b ("returned");
132 print br div {-align => "center"},
133 submit(-name => "submit",
135 -onClick => "window.close (self)");