Dear (name of recipient)
Explain that you are leaving, perhaps that it is your last day. Describe that you have accepted a new job, or that you have decided to head in a new direction with your career. Express how pleasurable it was working with those addressed in your letter.
Express your feelings about leaving; include the fact that you have created good friendships and memories, and that it is a sad day for you. Also mention that you hope the future will allow you to have the good experiences that you have had in this current job. Extend your well wishes for their future success and happiness in whatever they choose to do.
Thank the recipient for helping make your job more pleasurable and enjoyable, and for the help they have given you in making your job a success. Include an address if you are relocating, and invite the recipient to stay in contact after you leave.
Thanks again for everything.
Your farewell letter will help those you have become close to accept that you are leaving, and understand your reasons for doing so.