> question 1st : is it a good idea to reject any email which is not sent from a > domain (means sen...@domain.tld) any other like sen...@sub.domain.tld or > sub.sub.domain.tld is rejected ?
Generally, no, because you will reject legitimate domains that just look like subdomains, e.g. *.co.uk, *.or.at, ... There are lots of these: https://publicsuffix.org/list/public_suffix_list.dat > at least i tried with header checks in pcre > > /^From:\.*@.*\.*\.*/ DISCARD NO SUBDOMAINS . = any single char \ = special char for escaping, not the backslash character \. = the dot character itself (escaped dot) \\ = the backslash character (escaped backslash) * = zero or more times ? = zero or one time .* = everything or nothing (greedy) .*? = everything or nothing (non-greedy, smallest match) \s = whitespace \.* = the dot character zero or more times /^From:\.*@ This starts with From: then wants any number of the dot character followed by @, without any whitespace. It would match e.g. /^From:......@ or /^From:@ @.*\.*\.*/ @ followed by anything between nothing and everything, then followed by endless dots or no dots, followed by endless dots or no dots. This does not match domain names, try: /^From:\s*.*?@.*?\..*?\./ Pcre means perl compatible regular expressions. For details see: https://perldoc.perl.org/perlre > i have several anti spam feature enabled but i get still some messages which > are coming from subdomains or sub sub domains This is a job for antispam software, not for generic domain blocking. Best regards, Gerald _______________________________________________ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org