Kindly reference the following links:
What's the ruling on greeting non mahram? - Assim al Hakeem
Giving Salam to Non Mahram | Sheikh Assim Al Hakeem
The guidelines when dealing with the opposite gender (non mahram) due to necessity
Responding to a female's salam?