############################################################ # Defense in Depth - Anti-SPAM for sendmail environments # # by David Bank --> http://dave.trianglenug.org # ############################################################ # Code Example #4 - Perl - MIMEDefang - filter_recipient() # ############################################################ sub filter_recipient() { # Read the parameters passed to the function my($recipient, $sender, $ip, $hostname, $first, $helo, $rcpt_mailer, $rcpt_host, $rcpt_addr) = @_; # Local variable to hold results of md_check_against_smtp_server my(@chk_result); # A HELO string for MIMEDefang to use so that log entries on the other # mailserver can be distinguished as MIMEDefang checking my($chkhelo)="mimedefang.ourdomain.tld"; # Search the list of our hosts using the $ip argument if ( exists($OurHosts{$ip}) ) { # The connecting host is our own host, don't bother checking further return('CONTINUE', 'ok'); } else { # Verify the recipient address on $rcpt_host is valid using # md_check_against_smtp_server @chk_result = md_check_against_smtp_server($sender, $recipient, $chkhelo, $rcpt_host); } # Return the result without interpretation return(@chk_result); } # End of sub filter_recipient