Communicating your intention to the company: In order to make your departure as smooth as possible, you should do it in the correct and unambiguous manner: with a proper letter of resignation.
You can request a meeting with your boss and the H/R person and simply tell them, of course, but there are several disadvantages. It might not be possible to schedule a meeting when you want it - perhaps not even until after your departure! You really shouldn't spring this kind of news on your boss without warning; usually it will come as a bit of a shock and s/he won't cope with it properly at first. Certainly s/he will leave the meeting with a black expression and a grudge which will do you no good at all. You will also have lost control of the information you want to get across to the company: likely your resignation date won't be garbled but your reasons may be misunderstood or you might wind up saying more than you wanted to. And you'll have to sign some sort of confirming letter anyway!
So, write to them. And don't use e-mail. As convenient as it may be, by its usually free-form, colloquial, and informal nature, e-mail doesn't really convey the necessary solemnity and respect. (This is important. In the article "Composing your letter - what to do" we'll discuss the role of respect in the process). It can also be altered, mis-directed, or lost or deleted, deliberately or otherwise. The legal status of e-mail is very much evolving. While it can serve as evidence of a sort, there is no way that it at present is always acceptable as a contract or covenant. (Electronic signatures do exist but they can be faked!). So, write a letter.
Letters are difficult to alter, especially if copies are sent to various people; they are formal documents and are authentic; and they are completely clear and uncontrovertible if they are written properly. For your boss, they have the advantage that s/he can open and read them in privacy and explode in privacy if s/he wants to; s/he can consult you later about the matter in a reasonable state of mind. So write! You can mail them formally or slip them into the company mail system; the former of course is more secure from prying eyes. In either case, mark the envelope "Personal and Confidential"; that'll warn the recipient that it's serious business and will usually make sure that only the recipient will open it.