/* This file is part of mailfrom filter. Copyright (C) 2005, 2006 Sergey Poznyakoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #pragma option relay "/etc/mail/sendmail.cw" #pragma option relay "/etc/mail/relay-domains" #pragma option timeout 33 #pragma option mailfrom "" #pragma option ehlo "your.domain" #pragma regex +extended +icase #pragma option debug 1 prog envfrom do if $f = "" next elif hostname ${client_addr} matches ".*(adsl|sdsl|hdsl|ldsl|dialin|dialup|ppp|dhcp|dynamic).*" reject 550 5.7.1 "Use your SMTP relay" elif hostname ${client_addr} matches ".*-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}.*" on poll host ${client_addr} for $f do when success: next when not_found or failure: reject 550 5.1.0 "Sender validity not confirmed" when temp_failure: tempfail 450 4.1.0 "Try again later" done elif relayed hostname ${client_addr} next elif $f mx fnmatches "*.yahoo.com" or $f mx fnmatches "*.namaeserver.com" next else on poll $f do when success: next when not_found or failure: reject 550 5.1.0 "Sender validity not confirmed" when temp_failure: tempfail done fi if rate($f "-" ${client_addr}, interval("1 hour 30 minutes")) > 100 tempfail 450 4.7.0 "Mail sending rate exceeded. Try again later" fi done prog envrcpt do set gltime interval("1 hour") if $f mx fnmatches "*.yahoo.com" or $f mx fnmatches "*.namaeserver.com" and not dbmap("/var/run/whitelist.db", $client_addr) if greylist($client_addr "-" $f "-" $rcpt_addr, %gltime) if %greylist_seconds_left = %gltime tempfail 450 4.7.0 "You are greylisted for " %gltime " seconds" else tempfail 450 4.7.0 "Still greylisted for " %greylist_seconds_left " seconds" fi fi fi done