The Mezuza is one of Safrut's most interesting items. It must be written Kesidran, in order, and Chazal say that it provides a special heavenly protection to your house, something we don't see by any other Miztva. Last week I started to write my first Mezuza and this is the first time I write a piece of Safrut containing the Shem, so going to the Mikva became part of my daily schedule for the first time in my life.
But is the writing of the Mezuza part of the Mitzva? After all, if you read this pasuk literally it says "וכתבתם על מזוזות ביתך ובשעריך", that you should write it.
Incidently, the Samaritans interpret this last Pasuk literally and go even further - they write the Parshiot not in Klaf but in the actual wall just over the door (see picture). They understand that the commandment is that "You shall write on top of your doors".
But most commentators understand that although it's written וכתבתם , "you shall write", the Miztva of Mezuza is fulfilled when you affix the Mezuza scroll in the doorpost.
The Sefer Alei Desheh, authored by the brother-in-law of the Zanz Rebbe, has a lengthy discussion on this question and is of the opinion that the writing of the Mezuza IS part of the Mitzva, and goes so far to say that because of this you should hire a sofer to write the Mezuza specially for you, a principle that is applied to Hilchot Sefer Torah (if you don't hire a Sofer and buy a ready Sefer Torah you don't fulfill the Mitzva).
The Talmud Yerushalmi goes a step ahead and says that you should say a Brocho not only when affixing the Mezuza but also when writing it, and the Bracha is:
ברוך אתה ה' א‑לוהינו מלך העולם, אשר קדשנו במצותיו וצונו על כתיבת מזוזה
The Halacha is not like the Yerushalmi and, furthermore, Minhag Israel is not to hire a sofer for the writing of the Mezuza, but rather to just buy the Mezuza off the shelf. But I have nothing to lose and whenever I write my Mezuza I have the Kavana to fulfill the Mitzva of Mezuza according to the abovementioned opinions.