Some examples
if (LoggedIn())
{
LoggedOn();
if (true)
{
GetMail();
}
Makes not much sense, especially to someone trying to understand your program. A better idea would be something like:
if (Login())
{
GetMail();
}
else
{
}
You also only need one menu for something this simple, rather than a menu to login, and then another one that has the same option. Use
bool
values to save conditions which will be used throughout the program (e.g. the value that indicates user id logged in).
There are more things to be addressed but it would take too long to get round to them all.
It would pay you to write a simple design on paper to address the logic issues before you start coding. Think about the things that each part of the program needs to do. For example:
The main method should show a menu and switch logic paths depending on the user choice:
option 1: login to gmail (after getting userid and password).
option 2: get mail from gmail (checking that you are already signed in).
option 3: send a mail message.
option 4: terminate.
etc.