The first thing to remember is to always have a good introduction, whether formal or not, you need to introduce the letter with "Dear", or "To Whom It May Concern", or a greeting of sorts for the person that the letter is addressed to. Remember, this is the start of a letter, and doesn't need to be long, just keep it simple and traditional. The second thing to remember in regards to writing in a letter format is to communicate your thoughts clearly. It might take a few drafts to get all the information out and in a concise manner. You have to keep in mind that you want an audience for your writing, and that their time is precious. Do not get too longwinded; so make sure you hit the points you need to hit with concise speech and rhetoric. Start with an introduction paragraph that describes what you're going to talk about in the following writing, just do not make it too vague or too detailed, and find a happy medium. Another good tip is in regards to the body of the letter format. The body should have an informal touch to it, as if you're talking to someone that you know well. If you're giving instructions, asking for information, or anything that is not necessarily too formal, keep it friendly, light and to the point. Remember, you're writing a letter not necessarily a novel.
Please accept this letter as a formal notification of my resignation from the position [position title] with [company name]. I will be leaving my position due to unavoidable personal reasons that must be attended to immediately. I would like to thank you for this amazing opportunity that I was given for the past [Add the number of years you have been working in the role]. I greatly appreciate what I have learned here [Add the things you have learned here] and will take it with me throughout my career. My last working day will be [DD/MM/YY _ (one/two months from the date you give notice depending on company policy)]. I promise to wrap up my duties and train my replacement during this time. Please do let me know if there's anything else I can do to aid during this transition. I wish the company continued success, and I hope to stay in touch in the future. Sincerely, Find more resignation letter formats for specific reasons here.