Main functions work, but not together

I can now access Moodle and get my grades returned, and send an e-mail
to myself.  Code is not very pretty or efficient, next step is to fix
that, and then find out how to save data to a text file on the computer
for comparison when it checks for new grades.