#! /usr/local/bin/php * * 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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *** * * $Id: mfdnscheck.php,v 1.1 2004/07/05 18:27:21 pavcio Exp $ * */ error_reporting(0); if ($_ENV['NOMFDNSCHECK'] !== NULL) exit(0); /* get envelope sender address */ list($mail_login, $mail_domain) = split('@', $_ENV['SMTPMAILFROM'], 2); if (!$mail_domain ) exit(); /* no domain to check */ /* From PHP Manual: "according to RFC 2821 when no mail exchangers are listed, hostname itself should be used as the only mail exchanger with a priority of 0" so we check DNS_A too */ /* get DNS record */ $dnsrec = dns_get_record($mail_domain, DNS_A | DNS_MX); if (!is_array($dnsrec) || count($dnsrec) ) exit(); /* query failed or domain exists */ fwrite(STDERR, "non existing envelope sender domain: $mail_domain\n"); exit("E552 sorry, your envelope sender domain must exists (#5.7.1)\n"); ?>