Peter Bowyer wrote:
>On 17/09/05, Marc Perkel <marc@???> wrote:
>
>>Like to have a string function that extraced the main domain part out od
>>an email address that removes subdomains. And it would be smart enought
>>to deal with 3 part main domains such as:
>>
>>yahoo.co.uk
>>
>>Not sure what to call it but it would work like ${domman:address}
>>
>>
>
>Can you write a regex (or even explain in English) how to recognize
>the 'main domain'? If you can, the feature can be easily implemented
>in a ${sg function.
>
>
OK - here's some more details about the "Main Domain" concept.
Some domains are 2 part like:
yahoo.com
exim.org
some are 3 part:
yahoo.co.uk
yahoo.com.au
The idea is to figure out what the rules are to see if you need to grab
2 or three parts. The following code is a crude attempt to demonstrate
this concept but if it's doable it would be better if it were hard coded
in Exim.
warn message = X-Maindomain: \
${if match{XX${extract{-2}{.}{${domain:$h_From:}}}XX}{XX(co|com)XX}\
{${extract{-3}{.}{${domain:$h_From:}}}.${extract{-2}{.}{${domain:$h_From:}}}.${extract{-1}{.}{${domain:$h_From:}}}}\
{${extract{-2}{.}{${domain:$h_From:}}}.${extract{-1}{.}{${domain:$h_From:}}}}\
}
--
Marc Perkel - marc@???
Spam Filter: http://www.junkemailfilter.com
My Blog: http://marc.perkel.com