LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to reject addresses by TLD in Postfix? (https://www.linuxquestions.org/questions/linux-server-73/how-to-reject-addresses-by-tld-in-postfix-678757/)

inaki 10-24-2008 03:51 AM

How to reject addresses by TLD in Postfix?
 
Dear all,
I know that postfix can reject sender address by defining in mian.cf

"smtpd_sender_restrictions = hash:/etc/postfix/sender_access".

In sender_access file u can define whatever address such as

yahoo.com REJECT

My question is how can i reject the whole domain instead of full address like .jp, .ro, .my

Thank You

Mr. C. 10-26-2008 02:19 AM

Use a regexp or pcre map:

Code:

/etc/postfix/main.cf:

    smtpd_sender_restrictions =
        check_sender_access      pcre:/etc/postfix/sender_access


/etc/postfix/sender_access:

    /\.jp$/          REJECT Mail from .jp not accepted
    /\.ro$/          REJECT Mail from .ro not accepted
    /\.my$/          REJECT Mail from .my not accepted


inaki 10-26-2008 12:11 PM

and after that i need to issue command postmap /etc/postfix/sender_access. Is it right

Mr. C. 10-26-2008 12:32 PM

Never postmap for regexp or pcre tables. A postfix reload will cause postfix to read the tables immediately (or at its earliest convenience).


All times are GMT -5. The time now is 06:32 AM.