> The following is "concept"; I don't have the script yet ready, but
> it'll be easy to write with your favorite scripting language:
>
> -------
> 1. get your remote sender's current SPF record:
>
> dig yourremotesender.com txt  > tempfile
>
> 2. parse the result in tempfile with regex:
>
> /.*?ANSWER\sSECTION:.*?yourremotesender\.com*.\s+?\d+?\s+?IN\s+?TXT\s+?"v=spf1\s+?([^)]+?)\s+?.all"/
<snip>

The implementation seems a little fragile, but the concept should be
workable. On dig (at least the versions I've used), you can use +short
for parseable output. Example:

dig +short example.com TXT | grep 'v=spf1' | egrep -o 'ip4:[0-9./]+' |
sed 's/^ip4://' | sed 's/$/      OK/' > tempfile

Something like that, anyway.

Reply via email to