Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to block mail sending to yahoo or gmail from my mail server but I want to continue receiving mails from yahoo/gmail. I am using ubuntu 10.04 LTS, postifx mail server with mysql virtual mailboxes.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

You need to work with transport_maps. So put in main.cf

transport_maps = hash:/etc/postfix/transport

Then in /etc/postfix/transport put

gmail.com     error:You are not allowed to contact Google
googlemail.com     error:You are not allowed to contact Google
yahoo.com     error:You are not allowed to contact Yahoo

Don't forget to postmap /etc/postfix/transport afterwards.

Note that this will only deny the mentioned domain names. Not the MX records at all. Yahoo and Google have plenty alternative domain names that you have to take care of. So it would be probably better to firewall their MX servers. Which on the other hand will deny all mails to domains hosted at Google Apps or Google for Business.

share|improve this answer
    
Thanks!!! It's work for me!! –  user103373 Jan 3 '12 at 6:48
add comment

Try postfix restriction classes, i believe it's what you need. Reference: http://www.postfix.org/RESTRICTION_CLASS_README.html#internal

share|improve this answer
    
This will only work for incoming mail. –  mailq Dec 30 '11 at 23:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.