(4) Hear, O Israel! The LORD is our God, the LORD alone. (5) You shall love the LORD your God with all your heart and with all your soul and with all your might. (6) Take to heart these instructions with which I charge you this day. (7) Impress them upon your children. Recite them when you stay at home and when you are away, when you lie down and when you get up. (8) Bind them as a sign on your hand and let them serve as a symbol on your forehead; (9) inscribe them on the doorposts of your house and on your gates.
אונקלוס בר קלונימוס איגייר שדר קיסר גונדא דרומאי אבתריה... הדר שדר גונדא אחרינא אבתריה אמר להו לא תשתעו מידי בהדיה כי נקטי ליה ואזלי חזא מזוזתא [דמנחא אפתחא] אותיב ידיה עלה ואמר להו מאי האי אמרו ליה אימא לן את אמר להו מנהגו של עולם מלך בשר ודם יושב מבפנים ועבדיו משמרים אותו מבחוץ ואילו הקב"ה עבדיו מבפנים והוא משמרן מבחוץ שנאמר (תהלים קכא, ח) ה' ישמר צאתך ובואך מעתה ועד עולם איגיור תו לא שדר בתריה
§ The Gemara mentions other Romans who converted to Judaism. It relates: Onkelos bar Kelonimos converted to Judaism. The Roman emperor sent a troop [gunda] of Roman soldiers after him to seize Onkelos and bring him to the emperor. Onkelos drew them toward him with verses that he cited and learned with them, and they converted. ...The emperor then sent another troop of soldiers after him, to bring Onkelos, and said to them: Do not converse with him at all. The troops followed this instruction, and took Onkelos with them. While they grabbed him and were walking, Onkelos saw a mezuza that was placed on the doorway. He placed his hand upon it and said to the soldiers: What is this? They said to him: You tell us. Onkelos said to them: The standard practice throughout the world is that a king of flesh and blood sits inside his palace, and his servants stand guard, protecting him outside; but with regard to the Holy One, Blessed be He, His servants, the Jewish people, sit inside their homes and He guards over them outside. As it is stated: “The Lord shall guard your going out and your coming in, from now and forever” (Psalms 121:8). Upon hearing this, those soldiers also converted to Judaism. After that, the emperor sent no more soldiers after him.
(יג) חַיָּב אָדָם לְהִזָּהֵר בִּמְזוּזָה מִפְּנֵי שֶׁהִיא חוֹבַת הַכּל תָּמִיד. וְכָל זְמַן שֶׁיִּכָּנֵס וְיֵצֵא יִפְגַּע בְּיִחוּד הַשֵּׁם שְׁמוֹ שֶׁל הַקָּדוֹשׁ בָּרוּךְ הוּא וְיִזְכֹּר אַהֲבָתוֹ וְיֵעוֹר מִשְּׁנָתוֹ וְשִׁגְיוֹתָיו בְּהַבְלֵי הַזְּמַן. וְיֵדַע שֶׁאֵין דָּבָר הָעוֹמֵד לְעוֹלָם וּלְעוֹלְמֵי עוֹלָמִים אֶלָּא יְדִיעַת צוּר הָעוֹלָם. וּמִיָּד הוּא חוֹזֵר לְדַעְתּוֹ וְהוֹלֵךְ בְּדַרְכֵי מֵישָׁרִים. ...
(13) A person should pay heed to the precept of the Mezuzah; for it is an obligation perpetually binding upon all. Whenever one enters or leaves a home with the Mezuzah on the doorpost, he will be confronted with the Declaration of God's Unity, blessed be His holy name; and will remember the love due to God, and will be aroused from his slumbers and his foolish absorption in temporal vanities. He will realize that nothing endures to all eternity save knowledge of the Ruler of the Universe. This thought will immediately restore him to his right senses and he will walk in the paths of righteousness...
(ב) נתינתה בטפח החיצון: הגה י"א כשאדם יוצא מן הבית יניח ידו על המזוזה (מהרי"ל שם ומוכח בעבודת כוכבים דף י"א) ויאמר ה' ישמר צאתי וגו' (במדרש) וכן כשיכנס אדם לבית יניח ידו על המזוזה:
(2) The placement of the mezuzah is in the outer handbreadth of the door.
Rama: There are those who say that when a person leaves his house, he puts his hand on the Mezuzah there and says “God will guard my going, etc.” And so too when one enters a house, one puts his hand on the Mezuzah.
(א) ובכל עת שיצא מן הפתח יניח ידו על המזוזה ויאמר ה' שומרי ה' צלי על יד ימיני ה' ישמור צאתי ובואי מעתה ועד עולם וענין הנחת יד שכתב מוזכר בהדיא בפ"ק דע"ז (יא.):
Whenever a person walks out from their door, he should put his hand on the mezuzah and say "Hashem is my keeper Hashem is my protector by my right hand. Hashem will preserve my going out and my coming in from now until eternity."
The basis for placing the hand on the mezuzah is mentioned in the first chapter of Avodah Zarah (11a)
ברכי יוסף י"ד רפה:ד
יניח ידו על המזוזה וכו': והאריזצ"ל כתב יניח אצבע הנקרא "אמה" על שד"י וינשקנו ויתפלל לה' שישמרנו
Birkei Yosef on Yoreh Deah 285:4
You should place your hand on the mezuzah:The Arizal (the founder of contemporay Kabbalah) wrote that you should put your index finger on the name of God on the mezuzah and he should kiss his finger, and should pray that God will protect him.
