I am using Centos-5 and have configured postfix mail server. How to i configure SPF and DKIM in Postfix.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.
SPF and DKIM are two separate things. SPF you should read up on using www.openspf.org
As for DKIM, Steve Jenkins posted a great guide on his blog a year ago: http://stevejenkins.com/blog/2010/09/how-to-get-dkim-domainkeys-identified-mail-working-on-centos-5-5-and-postfix-using-opendkim/
Read the guide thoroughly to understand how it works and do not simply copy/paste the config and then ask "why doesn't it work?"
There is something to understanding DKIM and you must be patient and read a lot to make it work.
Your problem may well be your DNS configuration. Start with a static DNS address and get reverse DNS working. DKIM and SPF both have DNS components which need to be configured correctly. I don't believe either DKIM or SPF will solve your problem, but do get them working.
I have posted on Detecting Email Server Forgery. This is written from the perspective of the recipient. However, it specifies the DNS entries that your need. If you are having problems sending to Gmail and Yahoo, it is likely one of the rules in this document that is causing problem.
My post on Securing your Email Reputation with SPF outlines the various SPF records you may want on various servers. You should protect your domain, web domain, as well as your mail server domain.
My post on Implementing DKIM with Exim also covers key management and the DNS entries for bind. You will need these if you want your DKIM signatures to be valid.