Am 11.10.2012 14:20, schrieb Michael Storz: > Am 2012-10-11 13:36, schrieb Reindl Harald: > >> i do this via mysql and a daily php-script which is >> removing error-transport if the domain get a MX record >> which is NOT fakemx.net >> >> currently the table has some thousand recors from the last 2 years > > Do you populate the database manually or automatically by processing the > generated DSNs?
manually
my mail-system is completly mysql-based (postfix, dbmail, dovecot-proxy)
and controlled with a 100% self around the configuration developed web-UI
so i can paste in a text-field a domain per line and the backend-function
does the same verification as daily to check if the domain has to be removed
from error transports to skip valid domains
public function check_valid_target($input)
{
$invalid_mx = array('mx.fakemx.net');
if(strpos($input, '@') !== false)
{
$domain = $this->domain->get_by_address($input);
}
else
{
$domain = $input;
}
static $own_mta;
if(empty($own_mta))
{
$own_mta = $this->domain->liste_mta();
}
if(in_array($domain, $own_mta))
{
return true;
}
getmxrr($domain, $mx_records);
settype($mx_records, myarr);
if(!empty($mx_records))
{
foreach($mx_records as $mx_test)
{
if(!in_array($mx_test, $invalid_mx))
{
return true;
}
}
}
else
{
$a_records = gethostbynamel($domain . '.');
if(!$a_records)
{
usleep(100000);
$a_records = gethostbynamel($domain . '.');
}
if(!$a_records)
{
usleep(100000);
$a_records = gethostbynamel($domain . '.');
}
if(!$a_records)
{
return false;
}
else
{
static $static_valid;
static $static_invalid;
settype($static_valid, myarr);
settype($static_invalid, myarr);
foreach($a_records as $a_record)
{
if($a_record != '127.0.0.1')
{
if(in_array($a_record, $static_valid))
{
return true;
break;
}
if(!in_array($a_record, $static_invalid))
{
$fp = @fsockopen($a_record, 25, $errno, $errstr, 2);
if($fp)
{
@fclose($fp);
$static_valid[] = $a_record;
return true;
break;
}
else
{
@fclose($fp);
$static_invalid[] = $a_record;
}
}
}
else
{
return false;
}
}
}
}
return false;
}
signature.asc
Description: OpenPGP digital signature
