Wa `alaykum as-salam wa rahmatullahi wa barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Dear brother, thanks for your question, which reflects your care for having a clear view of the teachings of Islam. Allah commands Muslims to refer to the people of knowledge to get themselves well-acquainted with the teachings of Islam, as well as all aspects of life.
As far as the Islamic Shari`ah is concerned, interaction with persons from the opposite sex who are not forbidden in marriage is not haram, as long as the intention is pure and all dealings are in line with the teachings of Islam.
However, close friendship with a person from the opposite sex is haram, as it can lead to a haram act, which no one but Allah knows how, where, or when it can happen. This never means the prohibition of pure friendship for the purpose of cooperating with others on the basis of goodness and piety and in compliance with the teachings of Islam.
Responding to your question, Zeinab Al-`Alawani, instructor in fiqh and Islamic studies at the Graduate School of Islamic and Social Sciences in Ashburn, Virginia, the US, said:
The man-woman relationship is regulated in Islam in a way that secures piety and sincerity of faith. There are certain conditions when it comes to dealing with a person from the opposite sex, such as avoiding khulwa (seclusion of a woman with a non-mahram ), observing the Islamic dress code, speaking properly, restricting the friendship to the frame of work, study, family, etc.
As long as a man and a woman are publicly dealing with each other according to the teachings of Islam, this kind of friendship is pure. However, a married man might feel attracted to a woman other than his wife in a way that urges him to develop a closer relation with her. Such a situation should be avoided, as it can lead to an act that is haram.
Allah Almighty knows best.