What is clear and for sure is that one’s encounter with a non-mahram must be in a way that there is no sin or fear of sin involved.
As far as physical contact between a non-mahram man and woman and shaking hands goes, one must say:
The great maraji’ have said in general: “Shaking hands with a non-mahram is impermissible, unless there is something that prevents direct contact [like gloves], or secondary rulings apply to the situation, such as Darurah (urgency and having no choice).”
For instance, Imam Khomeini says: It isn't permissible for a man to touch the body of a non-mahram, even if it is the hands or face, unless it is done with gloves or over a cloth, given that there are no bad intentions and that the hand of the woman isn't squeezed. The same goes for a woman in regard to a non-mahram man.
Also, it is permissible for a man to touch a woman and vice versa in extenuating circumstances (Darurah) when the only solution is physical contact, like in the cases of medical attention and saving one who is drowning or on fire. Nonetheless, even in these cases, one should only confine himself to the amount of contact needed for the situation and no more.
Considering the situation mentioned in your question, the circumstances aren't urgent ones and Darurat doesn’t apply, therefore, if you are going to do so, you must somehow block direct contact using gloves and the like in order to refrain from haram.
 Tawdih al-Masa’il of the maraji’, vol. 2, issue 2442; Ibid, pg. 809, second question; Masa’ele Jadid, vol. 1, pp. 137-138.
 For further information, see: Tawdih al-Masa’il (annotated by Imam Khomeini), vol. 2, questions 36 and 37; Jami’ al-Masa’il, Ayatullah Fazel, vol. 1, issue 1717; Ajwibah al-Istifta’at (Farsi version), question 1310, pg. 290.
 Nijat al-Ibad, Imam Khomeini, pg. 364, issues 23 and 24.