terje
Joined: 25 Jul 2005 Posts: 88 Location: Sydney
|
Posted: Fri Sep 23, 2005 2:12 am Post subject: SPF Test: checks if an Internet domain has an SPF record |
|
|
We have created a script for testing whether a domain has an SPF record.
An SPF record identifies which servers are authorised to send email with the relevant domain name in the MAIL FROM:<xxx@domain.com> address part of the SMTP session. For details see http://spf.pobox.com
The script has been tested on a WINDOWS-2003 server running HOSTMONITOR v5.6beta.
The Hint for the script is: Params: <domain>
The start command for this script is: cmd /c %Script% %Params%
The body of the script is:-
Quote: | @echo off
REM query domain and return a SPF record status
if "%1"=="" goto NOPARAMS
setlocal
set DNS=%1
set FILE=%temp%\~spfcheck.%1.tmp
del %FILE%
nslookup -q=txt %DNS% > %FILE% 2>&1
FOR /F "tokens=*" %%B IN ('type %FILE% ^| FIND /I "***"') DO CALL :NODOMAIN %%B
FOR /F "tokens=*" %%B IN ('type %FILE% ^| FIND /I "v=spf"') DO CALL :OKRECORD %%B
echo ScriptRes:Bad:No Record
goto ALLDONE
:NODOMAIN
echo ScriptRes:Unknown:domain not found
goto ALLDONE
:OKRECORD
echo ScriptRes:Ok:%1
goto ALLDONE
:NOPARAMS
echo ScriptRes:Unknown:not enough parameters
goto ALLDONE
:ALLDONE
del %FILE%
exit |
An example of a domain with an SPF record that you can use for testing is: google.com.au |
|