It is permissible for men and women to speak to each other for a legitimate reason as long as temptation is avoided.
When men and women speak, there should be no inordinate softness or complaisance of speech.
Allah says: “O wives of the Prophet! you are not like any other of the women; If you will be on your guard, then be not soft in (your) speech, lest he in whose heart is a disease yearn; and speak a good word.” [Sûrah al-Ahzâb: 32]
This verse was sent with respect to the Mothers of the Believers, then how much more should its ruling apply to other women who are lower in honor than they were?
Women used to come the Prophet (peace be upon him) and talk to him in the presence of the Companions, and he had never refused to speak with them.
For example, Zaynab, the wife of Ibn Mas`ûd, asked Bilâl to ask the Prophet (peace be upon him) about giving Zakâh to one’s husband and children. [Sahîh al-Bukhârî and Sahîh Muslim]
Asmâ’ bint Yazîd asked the Prophet (peace be upon him) about ghusl after the end of menstrual period and after having sexual intercourse. Umm Sulaym asked about a woman having a wet dream and for the ruling thereto. [Sahîh al-Bukhârî and Sahîh Muslim]
Moreover, it was related that Abû Hurayrah spoke to a woman objecting to her for wearing strong perfume in public while going – or coming back – from the mosque. [Sunan Abî Dâwûd with good line of transmission]
There are many more examples, and all such talk can take place when needed if temptation is avoided, and the parties refrain from being soft and complaisant in speech.
Also, a man and woman should never be in seclusion together.
And Allah knows best.