You need to obtain a “NULLA OSTA” to be able to perform a legally and valid wedding in Italy. Different countries require different procedures to release this “Nulla Osta”. As a general rule, if a wedding is celebrated according to Italian regulations, it will also be valid in your native country (provided you can bring a Nulla Osta or something similar).
Paperwork is to be prepared before you come and sometime while you are here.
Usually there are no residency requirements, but depending on your nationality and city of your marriage, you may need to be in Italy at least 7 days before. If you can visit Italy once 3 to 6 months beforehand, you can prepare all the paperwork then and show up just the day of the wedding.