May Allah bless you and increase you in good.
Smiling is a good deed and a charity indeed. However, it depends on the situation. In your case, it is best to be avoided because of the possibility that the opposite gender may be attracted to that.
One can act upon the sunna and receive the reward of smiling at others by doing so with the same gender. Where it happens on accident or forgetfully out of habit, then this hoped to be forgiven. Intend in all of our actions only to please Allah. By doing that, then you will receive all the rewards you could ever hope for.
Allah says in the Quran, “Tell the believing men to restrain their looks and guard their privates. That is purer for them. God is cognizant of what they do.” [ Quran 24: 30]
Jarir b. ‘Abdullah reported: I asked Allah’s Messenger ( peace and blessings be upon him ) about the sudden glance (that is cast) on the face (of a non-Mahram). He commanded me that I should turn away my eyes. [Muslim]
We can see from the aforementioned that it is best to be avoided.
Allah knows best.
[Imam] Yama Niazi
Checked and Approved by Shaykh Faraz Rabbani