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.
You need to work with
Don't forget to
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.
Try postfix restriction classes, i believe it's what you need. Reference: http://www.postfix.org/RESTRICTION_CLASS_README.html#internal