Whether you work in an organisation for a few days or for years, leaving a note of thanks and appreciation to have worked with your colleagues is always a good gesture. In this age of efficient email communication, it takes only a few minutes to write a farewell message and email to all your colleague at once.
It is more or less a formality but some people can feel genuinely touched with a message from a departing colleague. This can help them keep memories of working with that individual in the longer run.
Normally, a farewell email starts with greeting all the colleagues, followed by inquiring about how was their day etc. Sometimes some of colleagues can be aware that you are leaving, but break the news at start of the email.
Spell out in simple but genuine words how was your experience while working with them. Also, a concise write-up helps more than other a lengthy one.
At the end of the email, wish all the colleagues for all the best in their career and future, while expressing a hope that you will meet them sometimes again in the future.
Leave your contact details, especially email or any social networking ID to remain in touch with them if they wish to.
End the email with salutation.