Ok, let me say this plain and clear, for the thousandth time:
There is no FROM address in the bitcoin system. You are asking a question that is without meaning in the system. The software you are writing will not do what you think it does, even if it appears to work more-or-less correctly most of the time.
Can you give me an example when this wont work if the transaction is sent from a client like bitcoin-qt?