The first person to invent an idea—as opposed to the first person to file a patent—is the legal inventor. That's why in cases of dispute, it's imperative to be able to prove the date when you first visualized the invention. Regardless of what you hear, mailing yourself a registered letter does not constitute legal proof of invention.
To protect your invention from potential challenges, the first thing you need to do is put your idea in writing. Your documentation must be complete, accurate and concise. Create research and development journals, and don't leave anything to guesswork. The journals should describe the invention in words and pictures, fully explaining how it operates. Include unusual or unexpected results, ideas or conversations, and date and witness them. Your witnesses should sign a non-disclosure agreement—a statement that requires them to respect the confidentiality of your work and allows you to discuss your invention with some protection.
Dated pictures of your invention are also useful (especially photographs, but drawings are also good), models or prototypes. Signed testimonies of other people to whom you showed, explained and demonstrated (if applicable) your invention helps prove that you conceived of the invention. If you hire others to make parts or perform some other task related to your invention, proof of such could also be valuable protecting your rights as the inventor.
There are several ways to show inventorship, but none of them are as valuable as filing an actual patent application. Getting your application on file remains the best credible evidence that you originated the claimed invention.