At a minimum the letter should state that you are leaving, when you are leaving, and thank them for the time that they have employed you. It is common courtesy to give at least two weeks notice before you leave your job, but sometimes you'll have no control over it.
It is important that you keep your letter positive, you want to maintain a good relationship with your employer and co-workers, and they can be potential future references or business associates. If you feel like your reason for leaving is honorable, you can include the reason for leaving in your letter, but if you think your reason for leaving may rub your employer the wrong way, there is no need to put the reason in your letter.
Resignation Letter Writing
The first paragraph of your letter should state that you are leaving and when you are leaving.
The second paragraph should explain your reason for leaving the company. (This paragraph is optional.)
In the third paragraph you can offer to make your resignation go smoothly for the company. For example, you can offer to help train a replacement with the time you still have left. (This paragraph is also optional.)
The last paragraph should thank the employer for the opportunity to work for, wish them well and/or express interest in maintaning your professional relationship.